输入名字显示其生日,没有则让输入生日,做记录
birthdays = {'Alice': 'Apr 1', 'Bob': 'Dec 12', 'Carol': 'Mar 4'} while True: print('Enter a name: (blank to quit)') name = input() if name == '': break if name in birthdays: print(birthdays[name] + ' is the birthday of ' + name) else: print('I do not have birthday information for ' + name) print('What is their birthday?') bday = input() birthdays[name] = bday print('Birthday database updated.') ''' Enter a name: (blank to quit) Alice Apr 1 is the birthday of Alice Enter a name: (blank to quit) xiaoming I do not have birthday information for xiaoming What is their birthday? 10.1 Birthday database updated. Enter a name: (blank to quit) xiaoming 10.1 is the birthday of xiaoming Enter a name: (blank to quit) 不输入 退出程序 '''