Python ';应为缩进块';错误
“welcome()”之后出现“应为缩进块”错误 有点糟糕,因为我刚开始学习它,我已经开始发疯了。 所以我用def编写了一堆函数,然后运行它,我做了“welcome()”Python ';应为缩进块';错误,python,function,block,Python,Function,Block,“welcome()”之后出现“应为缩进块”错误 有点糟糕,因为我刚开始学习它,我已经开始发疯了。 所以我用def编写了一堆函数,然后运行它,我做了“welcome()” .. 这不是我应该做的吗?就像错误所说的那样-你的缩进被取消了 你也可以这样做 elif print(“请选择一个有效选项:”)之后缺少一行:def cust\u opt():不应缩进。您希望这一行做什么elif-print('请选择一个有效选项:'):您的意思可能是else:print('请选择一个有效选项:')) #def
.. 这不是我应该做的吗?就像错误所说的那样-你的缩进被取消了 你也可以这样做
elif print(“请选择一个有效选项:”)之后缺少一行:
def cust\u opt():
不应缩进。您希望这一行做什么elif-print('请选择一个有效选项:'):
您的意思可能是else:print('请选择一个有效选项:'))
#define welcome as the main menu page for editing editing details.
def welcome():
print ('Welcome to SUNI-DAYS VILLA \n \nPlease choose to edit from the following:\n\n1-Personal Details\n2-Holiday Option\n3-Villa Options\n4-Additional Options\n\n0-Exit')
('\n')
main_option = input ('Option:')
#After choosing option, run their choice
if main_option ==('1'):
cust_opt()
if main_option ==('2'):
holiday_opt()
if main_option ==('3'):
villa_opt()
if main_option ==('4'):
add_opt()
if main_option ==('0'):
quit()
elif print ('Please choose a valid option:'):
welcome()
#Option 1- from welcome()
def cust_opt():
print ('Please answer ALL of the questions')
cust_title = input ('Choose an option:\n1-Mr\n2-Mrs\n3-Miss\n4-Ms\nTitle:')
if cust_title ==('1'):
cust_title1 ==('Mr')
if cust_title ==('2'):
cust_title1 ==('Mrs')
if cust_title ==('3'):
cust_title1 ==('Miss')
if cust_title ==('4'):
cust_title1 ==('Ms')
elif print ('Please choose your title')
cust_name = input ('Full Name:')
cust_age = input ('Age:')
cust_dono = input ('Door/Flat number:')
cust_str = input ('Street Name:')
cust_city = input ('City:')
cust_post = input ('Postcode:')
print(cus_title1 , cust_name, \ncust_age 'years old.',\n'Address:' , cust_dono, cust_str, \ncust_city, \ncust_post)
def welcome():
# ...
else:
print ('Please choose a valid option:')
return
welcome()
def cust_opt():
# ...
else:
print ('Please choose your title')
# ...
return