我已經在python中編寫了一個程序,它顯示了最多三個數字..雖然程序很容易輸出引發了一個問題..下面是我寫的代碼::Python程序的輸出沒有意義
#Program to find maximum of three numbers using function
def max_of_three(a,b,c):
if(a>b and a>c):
print("a is greater")
elif(b>a and b>c):
print("b is greater")
else:
print("c is greater")
print("Enter three numbers...")
a=int(input())
b=int(input())
c=int(input())
print(max_of_three(a,b,c))
現在,當我運行這個程序,在運行時::提供輸入後得到這個輸出
Enter three numbers...
58
45
12
a is greater
None
的reesult是好的。但我不明白的是,爲什麼單詞「無」正在打印?我的意思是什麼意思?
刪除最後一個print,即'max_of_three(a,b,c)'就足夠了,因爲你在該函數內部添加了'print' func。 –
如果a> b> c: –