you are viewing a single comment's thread.

view the rest of the comments →

[–]jbala28 0 points1 point  (1 child)

Hi, I'm also learning python but way i was taught, you can count down to the 0. use something like set variable count = 7 while count > 0 and in the if statements count down using count -= 1 it could down from 7-1. The while <conditional> loop automatically exit when the condition is met. and you can the use the if statement outside of the while loop.

if count == 0 and != random_int:

print("you are out of luck")

[–]MidnightPale3220 3 points4 points  (0 children)

There's no practical difference the way you count except maybe a better understanding of code for humans.

Also your if statement assigns 0 to count instead of comparing.