This is part 8 of a series of python coding that I am having fun with and want to show others that are interested or stuck.
Code Example:
#Creating a while loop guessing game
#This will loop until a condition has been met
#Declare your starting variables with assigned values
guess = 0
ans = 7
guess = int(input("What is your guess? "))
#Creating the while loop that will continue until the correct
#answer is guessed.
while guess != ans:
guess = int(input("Guess again! "))
if guess == ans:
break
else:
guess = int(input("Guess again! "))
#Convert guess into a string
sGuess = str(guess)
#Print the results of the guess
print("You got it! The answer is " + sGuess)
#python #pythonprogramming #pythontutorial #pythonforbeginners #shorts
Music: Paid Subscription with Wondershare Filmora
Auf dieser Seite können Sie das Online-Video Part 8 | Python Programming | Creating a while loop Guessing Game mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer oOSylarTechOo 02 Januar 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 305 Mal angesehen und es wurde von 13 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!