My very first post, trying to behave according to guidelines, if not pls lmk.
I've written some code for the "Guess a number between 0 and X" game. However, whenever I input type(str) as answer into the input box the game crashes. How do I make sure it does not crash, and instead prompts another input box telling the user to type a number?
Is it an else statement I need to wrap it all together? Snippet of the code block thats bothering me:
while gæt != b:
gæt = input("Venligst indtast et tal mellem 1 og " + str(num) + ": ")
if gæt.isdigit():
gæt=int(gæt)
if gæt == b:
print("Korrekt!")
if gæt < b:
print("For lavt - prøv igen")
if gæt > b:
print("For højt - prøv igen")
count += 1
if gæt.isstr():
print("Ugyldig indtastning - forsøg igen: ")
print("Du brugte", antal, "forsøg på at gætte tallet")