Help with my text adventure game!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help with my text adventure game!!!

I need help with the user choosing something from the lists. items = {'item1': 'bill', 'item2': 'cows', 'item3': 'pig'} bill = {'choice': 'Be in debt', 'choice2': 'be rich'} cows = {'choice': 'have beef', 'choice2': 'be fat'} pig = {'choice': 'have pork', 'choice2': 'be really fat'} print(items) choice = input("Select your item: ") if choice in items: the_choice = items[choice] else: print("Uh oh, I don't know about that item") print(choice + ' ok lets do this') print('you are going to pick the next choice from the list') if choice == 'item1': print(bill) If the user inputs 'item2' then it will print the list for cows. What do i use? If else or what?

7th Nov 2017, 5:11 PM
Hyrum Harris
Hyrum Harris - avatar
1 Answer
+ 1
nested if else statement, i think.
8th Nov 2017, 5:18 AM
Joan Lamrack
Joan Lamrack - avatar