簡體   English   中英

為什么這個用於百分比計算的 python 代碼不起作用?

[英]Why isn't this python code for percentage calculation not working?

考試為 470 分。 如果我獲得 450 分,百分比是多少 注意,100/470 = 0.21276595744

def percent(total):
percent = total*0.21276595744
x= percent(int(450))
print (percent(450))

輸出:無

你需要在你的函數中返回一個值:

def percent(total):
    return total*0.21276595744

print (percent(450))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM