Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

read in menu function is not defined. Can someone tell me what am i doing wrong?

+1 vote
asked Feb 26, 2020 by anonymous
import webbrowser
def login():
  username='harry banks'
  password='bluedaisy'
  print("enter your username")
  name=input()
  print("enter your  password")
  passcode=input()
  if name==username and passcode==password:
    print("access granted")
  else:
    print("invalid")
print()
login()

def menu():
  select=input("""Select the option:
                  a: read
                  b: latest updates
                  c: genre
                   choice of option is: """)
                   
                   
  if select== 'a' or select== 'A':  
     read()
  elif select=='b' or select=="B":
   latestupdates()
  elif select=='c' or select== 'C':
   genre()
print()
menu()                

def read():
 pass
print()
read()

1 Answer

+1 vote
answered Feb 27, 2020 by anonymous

def read():
 pass
def menu():
  select=input("""Select the option:
                  a: read
                  b: latest updates
                  c: genre
                   choice of option is: """)
                   
                   
  if select== 'a' or select== 'A':  
     read()
  elif select=='b' or select=="B":
   latestupdates()
  elif select=='c' or select== 'C':
   genre()
print()
menu()                
print()
read()

#The thing is you should define your function read() before using it

commented Feb 27, 2020 by anonymous
Thank you for the answer, but when i try to run the code read() function runs first, and i want to go to read  function from menu function when option "a" is selected.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...