首页 > 代码库 > Learn Python 010: Dictionary - Cinema Simulator
Learn Python 010: Dictionary - Cinema Simulator
films = { ‘Finding Dory‘: [3, 5], ‘Bourne‘: [18, 7], ‘Tarzen‘: [15, 9], ‘Ghost Busters‘: [12, 5] } while True: choice = input(‘Please enter the selected film: ‘).title().strip() if choice in films: age = int(input(‘Please enter your age: ‘).strip()) if age >= films[choice][0]: if films[choice][1] > 0: print(‘Enjoy.‘) films[choice][1] = films[choice][1] - 1 else: print(‘Sorry, we are sold out.‘) else: print("Sorry, you are too young to watch the film.") else: print(‘Sorry, we do not have this film.‘)
Learn Python 010: Dictionary - Cinema Simulator
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。