mardi 7 novembre 2017

How can I put a def function in an if statement [duplicate]

This question already has an answer here:

I want the program to run one of the defs if it meets a certain condition, but it wont work. Why?

def quizLevel():
    level = input("Choose Level By Typing In The Level Name \nEasy \n Medium \n Hard")
    if level == "Easy" or "easy":
            def easy()
        if level == "Medium" or "medium":
            def medium()
        if level == "Hard" or "hard":
            def hard()

def easy():
    print ("You Have Chosen The Easy Level. \n Welcome")


def medium():
    print ("You Have Chosen The Medium Level. \n Welcome")


def hard():
    print ("You Have Chosen The Hard Level. \n Welcome")

Aucun commentaire:

Enregistrer un commentaire