Reputation: 19
Help, I have no idea where I went wrong in my coding and I think that I didn't do something I should have, but everybody I asked says it's a good code. I assigned a variable (stats) to be a certain integer (15). Then I asked a user to input an integer into another variable (DEX). The program then will print one of three things depending if the variable is greater, less than, or equal to stats. Here's the full code for those who want to help:
stats = 15
DEX = raw_input(prompt)
if stats > DEX:
os.system("cls")
print TITLE
print "SO YOUR DEX IS %s CORRECT?" %(DEX)
time.sleep(4)
thread_2()
elif DEX > stats:
print "YOU HAVE TOO MUCH DEX!!"
elif DEX = stats:
print "ARE YOU SURE YOU WANT TO ADD ALL YOUR STATS TO DEX?"
Upvotes: 2
Views: 93
Reputation:
You need to make DEX
an integer by putting it in int
:
DEX = int(raw_input(prompt))
raw_input
always returns a string object. Meaning, you are trying to compare strings and integers, which won't work.
Also, regarding your last elif
, you need to use ==
for comparison tests. =
is for variable assignment.
Upvotes: 4
Reputation: 130
You are using the assignment operator in your last elif rather than the comparison operator. Your last elif should be:
elif DEX == stats:
print "ARE YOU SURE YOU WANT TO ADD ALL YOUR STATS TO DEX?"
Upvotes: 2