嗨,我正在學習python,我卡在製作一個年齡計算器。小於符號的基本Python語法錯誤
我不得不作出它要求用戶在未來幾年進入他們的年齡年齡計算器,如果用戶是100或以上,它告訴他們「你已經變成100!」。否則,如果他們小於0,告訴他們「當你出生時再試一次!」。如果這兩種情況都不是這樣,則計算年數,直到它們變爲100,並輸出消息「您將在x年內100次!」 (其中「x」被替換爲100之前的年數)。我必須使用if/elif/else語句來解決這個問題。
我花了幾年時間研究,使用PEP8和我發現的東西,但還是無法弄清楚如何做解決這個問題,或者如果我在正確的軌道上。先謝謝你!
1. age = input("Enter your current age in years: ")
2. if output = <100 input("You will be 100 in years!")
3.
如果'x'小於'y',則x
Zinki