lundi 23 novembre 2020

CAN WE ACESS DEF IN IF LOOP BEFORE ITS CREATION IN PYTHON

can I acess findit() in if loop on line no 3

def searchit():
search=input("WANT TO SEARCH YOUR DICTONARIES:")
if search in ["Y","y","YOU","you"]:
    def findit():
        print("ENTRE NAME SEARCH:")
        find=input()
        # s=dict.keys()
        if find in dict:
            l=dict.get(find)
            print(find,"class is",l)
        else:
            print("NAME NOT FOUND!")
    again=input("WHANT TO SEARCH AGAIN?:")
    if again in ["Y","y","YOU","you"]:
        return findit()
    else:
         pass
    findit()
else:
    pass

searchit()

please help!!! on giving output"y" not going in findit()

Aucun commentaire:

Enregistrer un commentaire