Python Tutorial - While Loop - Guessing Game

preview_player
Показать описание
Learn how to code a number guessing game in Python using a While loop. Also learn how to generate a random number.

Рекомендации по теме
Комментарии
Автор

I liked this tutorial a lot.
Summary of what I learned:
In the while loop, we have to repeat the (variable and value) above the while condition to prompt input again so it can keep asking for correct input. When the while condition is proven false (finally!), it leaves the while loop and moves on to the next line in the code.

Print("Bob wants you to find the right number so you can leave the dungeon."



Guess = int(input("enter num: ")

While Guess!= X:

print("Bob spins the dungeon lock once more. You're not getting out.")

Guess = int(input( "enter num:") #without this or would never prompt you again.

print ("Bob begrudgingly let's you or of the dungeon. You must be using witchcraft to guess so high. Back in the dungeon you go.")

applemilkshake
Автор

This was very helpful! But what if you want a specific number of trials to guess the answer

farahmessan
Автор

I could make the guess the number but then I wanted to add scores -1 incorrect +3 correct 0 you lose 100 you win
And user starts with 10 points

newstodayplus
Автор

I cant find why but the loop is infinity it isnt stop

wewergamer
join shbcf.ru