#Python TQC考題402 不定數迴圈-最小值
num = eval(input()) #輸入數值
min_num = num #將min最小值設定為初次輸入的值
while num != 9999:
if min_num > num:
min_num=num
#這一段屬於if函數
num=eval(input()) #這一段屬於while迴圈
print(min_num)

重寫一次

#使用list做
n=99999999
“””
# n起始值極大,
# 使用者不會輸入這麼大的數字
# 一append到list中
# 就是list中的最小值
“””
lst=[]
while n != 9999:
n=eval(input())
lst.append(n)
print(min(lst))

#使用while True做:
L=[]
while True:
n=eval(input())
if n == 9999:break
L.append(n)
print(min(L))




![Python 進階技巧:海象運算子 (Walrus Operator) 實戰教學 [w_clean for w in words if (w_clean:=w.lower().strip()) and w_clean not in STOPWORDS] Python 進階技巧:海象運算子 (Walrus Operator) 實戰教學 [w_clean for w in words if (w_clean:=w.lower().strip()) and w_clean not in STOPWORDS]](https://i0.wp.com/savingking.com.tw/wp-content/uploads/2026/02/20260210083748_0_a7d9bf.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

![Python: 如何使用 pydub (dub:配音)將m4a 轉換為wav? 用 os.environ [ “PATH” ] 設定環境變量; from pydub import AudioSegment Python: 如何使用 pydub (dub:配音)將m4a 轉換為wav? 用 os.environ [ “PATH” ] 設定環境變量; from pydub import AudioSegment](https://i0.wp.com/savingking.com.tw/wp-content/uploads/2024/09/20240905141103_0_95957e.png?quality=90&zoom=2&ssl=1&resize=350%2C233)




近期留言