2016-02-11 58 views
-4
#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()' ..不是我想要做的「應縮進塊」錯誤

+1

你缺少的elif打印後'行( 「請選擇一個有效的選項:」):'' – DJMcMayhem

+2

高清cust_opt():'不應該被縮進。 –

+2

你認爲這條線有什麼作用? 'elif print('請選擇一個有效的選項:'):'也許你的意思是'else:print('請選擇一個有效的選項:')' –

回答