-2
請幫我弄清楚這段代碼有什麼問題;第一個函數工作正常 但第二個函數返回錯誤的數字。第二個變量是post後返回的是從午夜開始的剩餘分鐘數。Python邏輯錯誤
def get_hours(s):
time=s/3600
return time
#The get_hour function returns how many hours have passed since midnight. The
# parameter is the time in seconds that has passed since midnight.
def get_minutes_remainder(s):
hours=get_hours(s)
minutes=s/60
a=round(hours)
b=a-hours
b=abs(b)
minutes=minutes*b
return minutes
你使用Python 2或Python 3? – Blender 2013-03-05 01:15:36
根據代碼使用的代碼是什麼樣子,您可能需要考慮日期時間模塊。 – daveydave400 2013-03-05 01:16:29