feedback revised 2

 avatar
user_0100208
plain_text
2 years ago
2.9 kB
2
Indexable
Never
total=[]
star=0
#Q1
while True:
   print("以下問卷兩題,若您願意填寫,請輸入Y,不願意填寫請輸入N")
   print("Y/N")
   x1=input()
   try:
        if x1 !="Y" and x1 != "N" and x1 != "y" and x1 != "n" and x1 !="":
            raise  KeyboardInterrupt
   except KeyboardInterrupt: 
        print ("錯誤! 請輸入Y或N")
   else:
    total.append(x1)
    if x1=="Y" or 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" and 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

if x2=="a" or x2=="A": star="⭐"
elif x2=="b" or x2=="B": star="⭐⭐"
elif x2=="c" or x2=="C": star="⭐⭐⭐"
elif x2=="d" or x2=="D": star="⭐⭐⭐⭐" 
else: star="⭐⭐⭐⭐⭐"

#Q3
while True:
    if x2=="a" or x2=="b" or x2=="c": 
        print ("請告訴我們為什麼您給予酒吧",star,"的評價?(複選,不需要以空格隔開)")
        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","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 ("請告訴我們為什麼您給予酒吧",star,"的評價?(複選,不需要以空格隔開)")
        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","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
print("1.是否答題",total[0],"2.給幾星",total[1],"3.原因",total[2])