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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -