NameError: name 'one' is not defined python 3.4 error -


a=str(input("enter num start functionone")) if(a == '1'):     one()    elif (a == '2'):     tow()     def one():     print('good')  def tow():     print('very good') 

error

enter numper start functionone1 traceback (most recent call last):   file "c:/users/hacker/desktop/complex program.py", line 3, in <module>     one() nameerror: name 'one' not defined 

you need define functions before calling them:

def one():     print('good')  def tow():     print('very good')  a=str(input("enter num start functionone")) if(a == '1'):     one()    elif (a == '2'):     tow() 

if call function function defined below won't work because python doesn't know yet function call supposed do.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -