Question:
Guess it might be pretty simple when you know. But have struggled for an hour now
I can’t make the code break when the input is exit. I know the first steps could be more smooth looking at the solution. But looks like it’s the comparison or while True loop, where i do something wrong.
Thanks
import random, os, time
greeting = ["Hej", "Hallo", "Goddag", "Gutentag", "Davs", "Hejsan", "Tjenna", "Ciao"]
def randhilsen():
tilf = random.randint(0, 7)
return tilf
while True:
signoget = input("Sig noget: ")
if signoget != "Exit":
supertilf = randhilsen()
hilsen = greeting[supertilf]
print(
f"""Man kan sige hej på mange måder eksempelvis
{hilsen}"""
)
time.sleep(5)
os.system("clear")
else:
break