Help day 32 - Python

Question:
Guess it might be pretty simple when you know. But have struggled for an hour now :confused:

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 :slight_smile:

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

11 posts were merged into an existing topic: Day 032 - Project 32 : Greetings in Different Languages