new to programmation, im learning and here is probably a very simple problem for you guy.
import random
def run_stair_yes():
print "\nRunning in stairs is very dangerous!"
print "Statistique shows that you have 70% chance of falling"
print "\nroll the dice!"
for i in xrange(1):
print random.randint(1, 100)
if i <= 70 :
print "\nWell, gravity is a bitch. You fell and die."
elif i >= 71 :
athlethic()
else:
print "im boned!"
exit(0)
my problem is that, whatever number is generated, it's always giving me the same "gravity is a bitch. You fell and die".
where do i go wrong ?
You never actually set i to the random.randint()
You say
for i in xrange(1):
Where i takes the value of 0
as you iterate through the xrange(1)
and then you just print out the result of random.randint(1, 100)
, not assigning it to i.
Try this
i = random.randint(1, 100)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With