123

 avatar
unknown
python
2 years ago
945 B
5
Indexable
# 提示用戶輸入身高,並使用 int() 函數將輸入轉換為整數
height = int(input("輸入身高\n"))

# 如果身高大於等於 180,則直接通過
if height >= 180:
    print("pass")

# 如果身高小於 180,則需要進行以下判斷
else:
    # 首先要求用戶輸入帥氣程度,並使用 int() 函數將輸入轉換為整數
    handsome = 0
    while not (1 <= handsome <= 10):
        handsome = int(input("有多帥 1~10分\n"))
    
    # 如果帥氣程度大於等於 5,則直接通過
    if handsome >= 5:
        print("pass")
    
    # 如果帥氣程度小於 5,則需要進一步判斷是否貼心
    else:
        str = ""
        while not (str == "Y" or str == "N"):
            str = input("貼心嗎 (Y/N)\n")
        
        # 如果貼心,則直接通過,否則失敗
        if str == "Y":
            print("pass")
        else:
            print("fail")