Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Unsolved reference in python

So i am making  a program with python

and i have defined an option, but it shows up as not...
 

option = input("Select your language: lan1/lan2")

if option == "lan1":
    menu1()
elif option == "lan2":
    menu()
else:
    print("Wrong option")

def menu1() :
    print("Soon")
def menu() :
    #stuff

 

Link to post
Share on other sites

Might not be the problem but the interpretor reads top to bottom so you should move you functions to the top.

 

Shouldn't use functions before they are defined.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to post
Share on other sites
4 minutes ago, vorticalbox said:

Might not be the problem but the interpretor reads top to bottom so you should move you functions to the top.

 

Shouldn't use functions before they are defined.

Still doesnt work 

option = input("Select your language: lan1/lan2")

def menu1() :
    print("Soon")
def menu() :
    #stuff
    
if option == "lan1":
    menu1()
elif option == "lan2":
    menu()
else:
    print("Wrong option")

 

Link to post
Share on other sites
Just now, Zuccers said:

Still doesnt work

It may be the hitting enter is also adding a new line char to the input?

 

Have you printed out input to see what it contains?

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to post
Share on other sites
1 minute ago, vorticalbox said:

It may be the hitting enter is also adding a new line char to the input?

 

Have you printed out input to see what it contains?

Nothing, it's the same 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×