Python Forum

Full Version: Help with conditional statement
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My friend and I are creating a terrible game, and for picking the biome, it acts like I chose 1 no matter what I choose. What am I doing wrong?

import pygame
import time
import os


name = raw_input("""Hello, welcome to Snek World.
You are a snek what is your name? """)
time.sleep(1)
print ("Hi, %s Welcome to Snek World" % (name))
time.sleep(2)
#Pick a Biome
biome = raw_input ("""Here in Snek World we have tons of
different biomes! Pick where you want to live. (Sneks vary in each biome.)
1. Desert
2. Rainforest
3. Plains
""")
time.sleep(2)
os.system('cls')

#Desert Snakes (DSC = Desert snake choice)
if biome == 'Desert' or '1':
DSC = input ("""Good choice! There are lots of sneks from the
desert! (Pick which snek you want to be)
1. Kenyan Sand Boa
2. Cobra
3. California King Snake
""")

#Rainforest snakes (RSC Rainforest snek choice)
elif biome == 'Rainforest' or '2':
RSC = input ('''Good choice! There are lots of sneks from the
rainforest! (Pick which snek you want to be)
1. Tri-color hognose
2. Rainbow Boa
3. Bush Viper
''')

#Plains (PSC Plains snek choice)
elif biome == 'Plains' or '3':
PSC = input ("""Good choice! There are lots of sneks from the
plains! (Pick which snek you want to be)
1. """)


#DSC Choice
if DSC == '1' or 'Kenyan Sand Boa' or 'Kenyan sand boa':
print ('%s the Kenyan sand boa, I like it!')
You are using the 'or' operator incorrectly. Please read this. And please post your code in python tags in the future. See the BBCode link in my signature below.
(Sep-25-2017, 02:12 AM)ichabod801 Wrote: [ -> ]You are using the 'or' operator incorrectly. Please read this. And please post your code in python tags in the future. See the BBCode link in my signature below.
Thanks. It works now. I'm really new to python.