Python Forum
I need help with my code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help with my code
#3
It describes mainMenu(): as being invalid syntax. Why is this?
def mainMenu():
    print("1.John Smith")
    print("2.Lucy Jones")
    print("3.Edward Johnson")
    print("4.Amy Harris")
    print("5.Christopher McDonald")
    print("6.Naomi Scott")
    print("7.Stewart Mackay")
while True:
    try:
        selection=int(input("Enter Patient Number"))
        if selection==1:
            JS()
            if selection==2:
                LJ()
                if selection==3:
                    EJ()
                    if selection==4:
                        AH()
                        if selection==5:
                            MC()
                            if selection==6:
                                NS()
                                if selection==7:
                                    SM()
                    
        else:
            print("No Patient Found")
            mainMenu():
                except: ValueError:
                    print("Invalid Patient Name")
                    def JS():
                        print("DoB 03/01/1952 Male Diabetes T2")
                        anykey=input("Enter Any Key To Return")
                        def LJ():
                            print("DoB 28/06/1984 Female HIV")
                            anykey=input("Enter Any Key To Return")
                            def EJ():
                                print("DoB 21/04/2001 Male Lupus")
                                anykey=input("Enter Any Key To Return")
                                def AH():
                                    print("DoB 01/09/1944 Female Diabetes T2")
                                    anykey=input("Enter Any Key To Return")
                                    def MC():
                                        print("DoB 20/12/1975 Male Epilepsy")
                                        anykey=input("Enter Any Key to Return")
                                        def NS():
                                            print("DoB 17/08/1997 Female Crohn's Disease")
                                            anykey=input("Enter Any Key To Return")
                                            def SM():
                                                print("DoB 12/05/1964 Male Heart Disease")
                                                anykey=input("Enter Any Key To Return")
Reply


Messages In This Thread
I need help with my code - by pasteldreams - Mar-13-2020, 09:46 AM
RE: I need help with my code - by buran - Mar-13-2020, 10:06 AM
RE: I need help with my code - by pasteldreams - Mar-13-2020, 10:36 AM
RE: I need help with my code - by buran - Mar-13-2020, 10:51 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020