Dec-22-2019, 10:27 PM
Can also trow in string formatting f-string,
then it look better than doing convert with
then it look better than doing convert with
str
and concatenate with +
.import random attempts = 0 guess = 0 number = random.randint(1, 100) while guess != number: if attempts < 1: guess = input("Feeling lucky?5 Take a guess!\n") attempts += 1 elif guess > number: guess = input("Too high! Would you like to try again?\nEnter a number = Yes Alt + F4 = No\n") attempts += 1 elif guess < number: guess = input("Try a bit higher! Would you like to try again?\nEnter a number = Yes Alt + F4 = No\n") attempts += 1 guess = int(guess) else: if attempts < 5: print(f"Congratulations! That only took you {attempts} attempts - pretty impressive!") elif int(attempts) < 10: print(f"It took you {attempts} tries, but you got there eventually!") else: print(f"Gosh! {attempts} guesses?! It's not your lucky day.") print(input("How long did you spend trying?\n") + "? Lol")