NoneType'对象不可调用

时间:2019-09-08 20:35:25

标签: python-3.x

print ('There are',232//60) ('hours and',232%60) ('minutes in 232 minutes')

我尝试了很多事情,虽然是我的老师回答,但它不允许我

1 个答案:

答案 0 :(得分:0)

您的老师的实际建议:

print( 'There are',232//60 , ' hours and ', 232%60 , 'minutes in', 232, 'minutes')

恕我直言,一种更好的方法(在3.6及更高版本中可用):

print( f'There are {232//60} hours and {232%60} minutes in {232} minutes')

更好的是将分钟数作为变量:

minutes = 232
print( f'There are {minutes//60} hours and {minutes%60} minutes in {minutes} minutes')