Last active
July 14, 2024 20:29
-
-
Save kbatchelli/a4c540f02348477324c75c6611a68a67 to your computer and use it in GitHub Desktop.
g.v.1.4.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
max_score=100 | |
max_scorer="" | |
while True: | |
print("Top score: %d by %s" % (max_score,max_scorer)) | |
name = input("what’s your name?") | |
print("hello %s" % name) | |
answer = random.randint(1,100) | |
guess=0 | |
n_guesses=0 | |
print("You are now playing the number guessing game v.1.4 whats your guess?") | |
while (guess != answer): | |
n_guesses=n_guesses+1 | |
guess = int(input("enter your guess num. %d: " % n_guesses)) | |
if guess == answer: | |
print("Yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay!") | |
break | |
elif guess < answer:print("Too low.") | |
elif guess > answer:print("Too high.") | |
if (n_guesses<max_score): | |
max_score=n_guesses | |
max_scorer=name |
this is python 3.4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a any-amount-of-players number guessing game.