當前位置:首頁 » 編程語言 » python尋找最大值

python尋找最大值

發布時間: 2025-03-03 22:15:23

python 求最大值

####求10個數據的最大值########
list=[]
for i in range(10):#這里可以設置數據的多少
list.append(float(input("請輸入數據"))) #輸入數據,如果都是整數可以把float改為int
max=list[0]
for i in range(10):#這里數據與上面的for裡面的保持一致
if list[i]>max:#如果數據比max大就會更新max
max=list[i]
print("最大值為:%f"%max)#輸出
#望採納

熱點內容
scratch少兒編程課程 發布:2025-04-16 17:11:44 瀏覽:642
榮耀x10從哪裡設置密碼 發布:2025-04-16 17:11:43 瀏覽:368
java從入門到精通視頻 發布:2025-04-16 17:11:43 瀏覽:89
php微信介面教程 發布:2025-04-16 17:07:30 瀏覽:312
android實現陰影 發布:2025-04-16 16:50:08 瀏覽:794
粉筆直播課緩存 發布:2025-04-16 16:31:21 瀏覽:348
機頂盒都有什麼配置 發布:2025-04-16 16:24:37 瀏覽:213
編寫手游反編譯都需要學習什麼 發布:2025-04-16 16:19:36 瀏覽:818
proteus編譯文件位置 發布:2025-04-16 16:18:44 瀏覽:369
土壓縮的本質 發布:2025-04-16 16:13:21 瀏覽:596