【发布时间】:2014-10-21 14:08:07
【问题描述】:
我需要使用余数运算符将其转换为小时和分钟格式的帮助。总的来说,我对 python 和编码比较陌生,因此非常感谢您的帮助。
#Define the value of our variables
numberOfEpisodes = 13
minutesPerEpisode = 42
#Calculate the results
totalMinutes = numberOfEpisodes * minutesPerEpisode
equivalency=totalMinutes//minutesPerHour
#Display the output
print(numberOfEpisodes, 'episodes will take', totalMinutes, 'minutes to watch.') print('This is equivalent to', equivalency)
这是我目前拥有的,我能够获得有多少小时,但我不知道如何调整代码以包含剩余的分钟数。
对不起,如果我没有充分理解,但希望你能理解。
【问题讨论】:
-
提示:在编程中,“余数”通常有不同的名称:“模数”。这可能会对您的研究有所帮助。
标签: python python-3.x integer divide