Python Forum
Help with conditional statement
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with conditional statement
#1
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!')
Reply
#2
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.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
(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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Common understanding of output processing with conditional statement neail 6 826 Sep-17-2023, 03:58 PM
Last Post: neail
  need help in conditional statement if else kambohg 3 1,860 Mar-27-2020, 12:27 AM
Last Post: kambohg

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020