我是Python的新手,我試圖創建一種非常特定的循環。我讀過的東西確實幫助了我。也許因爲這不是我的意思,或者因爲我不明白。我會試着問,希望有人能理解我。我基本上只是試圖重播上面的四條線。在Python中創建if/else循環
def defoption():
option = ("Give an input") #<- Trying to replay this line
option_input = input("Input: ") #<- and then this
if (option_input == 'a'):
print("Option a works")
else:
return option and print("Option unavailable")
defoption()
你的問題實在是不清楚......你想 「重演」 什麼?你想達到什麼目的? – Sayse
預期產量是多少? –
也許你需要一個循環,雖然選項不等於某個東西,但你重複該功能? – rmjoia