-2
def greater_less_equal_5(answer):
if answer > 5:
return 1
elif answer < 5:
return -1
else:
return 0
print greater_less_equal_5(4)
print greater_less_equal_5(5)
print greater_less_equal_5(6)
這些數字:4,5,6是什麼意思,並在結束打印?這些在打印中意味着什麼?
4,5,6分別作爲參數傳遞到函數中,並且返回的值被打印在屏幕上。請參閱 - https://www.tutorialspoint.com/python/python_functions.htm以瞭解有關功能的更多信息。 –
@RohinGopalakrishnan在OP的例子中,'print'是一個聲明,不是函數。然而,它被改爲了一個函數,在Python 3.x中。 –