Feedback 2

僅有三題。第一提問要不要答題。第二題問總共給幾星。第三題問給星理由。
 avatar
user_0100208
plain_text
2 years ago
2.4 kB
3
Indexable
total=[]
#Q1
while True:
   print("以下問卷兩題,若您願意填寫,請輸入Y,不願意填寫請輸入N")
   print("Y/N")
   x1=input()
   try:
        if x1 !="Y" and x1 != "N" and x1 != "y" and x1 != "n":
            raise  KeyboardInterrupt
   except KeyboardInterrupt: 
        print ("錯誤! 請輸入Y或N")
   else:
    total.append(x1)
    if x1=="Y": 
        print ("謝謝,請接續作答!")
        break
    else : 
        print("了解,謝謝!") 
        exit()

#Q2
while True:
   print("Q1: 整體而言,您會給這間酒吧幾個星星")
   print("a.⭐ b.⭐⭐ c.⭐⭐⭐ d.⭐⭐⭐⭐ e.⭐⭐⭐⭐⭐")
   x2=input()
   try:
        if x2 != "a" and x2 !="b" and x2 !="c" and x2 !="d" and x2 !="e":
            raise  KeyboardInterrupt
   except KeyboardInterrupt: 
        print ("錯誤! 請輸入a,b,c,d,e,f")
   else: 
    total.append(x2)
    break

while True:
    if x2=="a" or x2=="b" or x2=="c": 
        print ("請告訴我們為什麼您給予酒吧這樣的評價?(複選,不需要以空格隔開)")
        print("a.氣氛差 b.食物差 c.食物很貴 d.酒很難喝 e.酒太貴 f.環境骯髒 g.環境吵鬧 h.服務態度差 i.送餐速度太慢")
        y2=input()
        try:
            i=0
            for x in y2:
                if x not in ("a","b","c","d","e","f","g","h","i"):
                    i+=1
                else: i=i
            if i !=0:
                    raise  KeyboardInterrupt
        except KeyboardInterrupt: 
            print ("錯誤! 輸入選項只能涵蓋a,b,c,d,e,f,g,h,i")
        else:
            total.append(y2)
            print("感謝您的作答")
            break
    else: 
        print ("請告訴我們為什麼您給予酒吧這樣的評價?(複選,不需要以空格隔開)")
        print("a.氣氛佳 b.食物好吃 c.食物cp值高 d.酒很好喝 e.酒cp值很高 f.環境乾淨 g.環境安靜 h.服務態度佳 i.送餐速度很快")
        y2=input()
        try:
            i=0
            for x in y2:
                if x not in ("a","b","c","d","e","f","g","h","i"):
                    i+=1
                else: i=i
            if i !=0:
                    raise  KeyboardInterrupt
        except KeyboardInterrupt: 
            print ("錯誤! 輸入選項只能涵蓋a,b,c,d,e,f,g,h,i")
        else:
            total.append(y2)
            print("感謝您的作答")
            break
Editor is loading...