Advertisement
mengyuxin

meng.birthdays.py

Dec 30th, 2017
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. # birthdays.py
  2.  
  3. birthdays = {'Alice': 'Apr 1',
  4.              'Bob': 'Dec 12',
  5.              'Carol': 'Mar 4',
  6.              'Dream': 'Jun 3',
  7.              'Vincent': 'Aug 3',
  8.              'Tony': 'Mar 11'}
  9.  
  10. while True:
  11.     print('Enter a name: (blank to quit)')
  12.     name = input()
  13.     if name == '':
  14.         break
  15.     elif name in birthdays:
  16.         print(birthdays[name] + ' is the birthday of ' + name)
  17.     else:
  18.         print('I do not have birthday information for ' + name)
  19.         print('What is their birthday?')
  20.         bday = input()
  21.         birthdays[name] = bday
  22.         print('Birthday database updated.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement