An if statement is built on conditions. If you plan to use a statement with multiple different 'triggers' you must state the new conditions for each.
As such, your statement requires cake ==
for every potential true or false outcome.
import time
print("Here comes dat boi")
time.sleep(.5)
print("Waddup dat boi")
time.sleep(1)
name = input("Whats your name?\n")
print ("Hello,",name)
time.sleep(.5)
cake = input("Hello, want some cake?\n")
if cake == 'yes' or cake == 'ya' or cake == 'Ya':
print("Cool!")
else:
print('Aww..')
To help with your confusion, I believe the or 'ya' or 'Ya'
resulted in true due to both the user input and 'ya'/'Ya' being of the string type.
Do not quote me on that last part. My assumption may be incorrect.
Edit: Your comment "
Isaac It probably works but the or should hook them up. It was working earlier. It will work with one word but if not it will all ways say Cool!" suggests that my assumption regarding the type match resulting in true is in fact correct. That could be why earlier testing could have made the or
seem like it was hooking the different possibilities.
The following code if cake in ('yes', 'Ya','ya'):
would be the correct method of 'hooking' the different possibilities into a single condition.
Fixed Answer for OP:
import time
print("Here comes dat boi")
time.sleep(.5)
print("Waddup dat boi")
time.sleep(1)
name = input("Whats your name?\n")
print ("Hello,",name)
time.sleep(.5)
cake = input("Hello, want some cake?\n")
if cake in ('yes', 'Ya','ya', 'fine', 'sure'):
print("Cool!")
else:
print('Aww..')