python - Elif causing a syntax error -


i trying write function (in python 3.4) allow user make choice output shown. first elif line keeps getting flagged invalid syntax. i'm not sure i'm doing wrong. here's code:

def questionfunction () :             q1=input('would to: \n1. submit input , see costs \n2. view summary data \n3. reset summary data \n4. exit \n input corresponding number choice here: ')              if q1 == 1:                     print ("cost = $" + format(str(costfunction()), '.4'))                     print ("shipping cost = $" + format(str(shippingfunction()), '.4'))                     print ("total cost = $" + format(str(totalcostfunction()), '.4')             elif q1 == 2:                     print ("user count = " +str(count))                     print ("total revenue = $" + format(str(totalrevenue), '.4'))             elif q1 == 3:                     count = 0                     totalrevenue = 0             else                     print ("this program close") 

this compiles without problem.

def questionfunction() :             q1=input('would to: \n1. submit input , see costs \n2. view summary data \n3. reset summary data \n4. exit \n input corresponding number choice here: ')              if q1 == 1:                     print ("cost = $" + format(str(costfunction()), '.4'))                     print ("shipping cost = $" + format(str(shippingfunction()), '.4'))                     print ("total cost = $" + format(str(totalcostfunction()), '.4'))             elif q1 == 2:                     print ("user count = " +str(count))                     print ("total revenue = $" + format(str(totalrevenue), '.4'))             elif q1 == 3:                     count = 0                     totalrevenue = 0             else:                     print ("this program close") 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -