Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to loop this
#4
(Aug-18-2020, 03:24 AM)dirtdude Wrote: guess = input("guess a number between 1 and 50 ")
guess = int(guess)
if guess == 31:
print("yes!The correct answer is " + str(guess) )
else:
print("wrong,try again ")





this is my code,but I dont know how to loop it,can someone please give suggestions on how to fix it(im a 12 year old kid that just started,so I need some help)
If you are aware of for loops and while loops, I'm pretty sure youu would be knowing the answer. However, to help youu to begin with, a while loop is basically a loop that runs until a given condition is satisfied, whereas a for loop is used for iterating over a sequence
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply


Messages In This Thread
how to loop this - by dirtdude - Aug-18-2020, 03:24 AM
RE: how to loop this - by ndc85430 - Aug-18-2020, 05:10 AM
RE: how to loop this - by perfringo - Aug-18-2020, 09:44 AM
RE: how to loop this - by pyzyx3qwerty - Aug-20-2020, 01:56 PM
RE: how to loop this - by Marbelous - Aug-20-2020, 03:57 PM

Forum Jump:

User Panel Messages

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