We are creating a text game for a class project and I have an issue with the defined statement below. Logically, it seems right, but functionally, it is not working. The 'Item' is added to my list regardless of the input.
def show_item(current_location):
room_item = ''
if 'Item' in current_location:
room_item = current_location['Item']
print('You see a', room_item)
pick_up = input('Would you like to pick up item?')
if pick_up == 'Yes' or 'yes' and room_item not in current_items:
current_items.append(room_item)
elif pick_up != 'Yes' or 'yes':
pass
else:
print('You currently have this item')
else:
print('Invalid Input')
return room_item
This is the output below I receive:
Escape The Freeze
Collect 6 items to win the game, or be frozen alive!
Move commands: South, North, East, West or Exit
Invalid Input
You are in the Gym
Your current items:
Enter a command North
You see a meal
Would you like to pick up item?No
You are in the Teachers Lounge
Your current items: meal
Enter a command South
Invalid Input
You are in the Gym
Your current items: meal
Enter a command South
You see a gloves
Would you like to pick up item?woo woo
You are in the Office
Your current items: meal,gloves
Enter a command