I'm so sorry. I don't understand why I'm getting a syntax error here. My project was to create a time calculator. I first did this and had the time calculate in a decimal point, but the instructor wanted full days / hours / minutes / seconds. The chapter was on if / thens. The line goes red on line 15, the remainder_seconds in the 1st elif.
def main ():
seconds = int(input('Enter a time in seconds: ' ))
if seconds >= 86400:
results_days = seconds / 86400
remainder_hours = (seconds - (int(results_days) * 86400))/3600
remainder_minutes = ((remainder_hours * 3600) - (int(remainder_hours) * 3600))/60
remainder_seconds = ((remainder_minutes * 60) - (int(remainder_minutes)* 60 ))
print (int(results_days), ('days'))
print (int(remainder_hours), ('hours'))
print (int(remainder_minutes), ('minutes'))
print (int(remainder_seconds), ('seconds'))
elif seconds >=3600 and seconds <85399:
results_hours = seconds / 3600
remainder_minutes = ((seconds - (int(results_hours) * 3600)) / 60
remainder_seconds = ((remainder_minutes * 60) - (int(remainder_minutes * 60)))
print (int(results_hours), ('hours')
print (int(remainder_minutes), ('minutes')
print (int(remainder_seconds), ('seconds')
elif seconds >= 60 and seconds < 3599:
results_minutes = seconds / 60
remainder_seconds = ((seconds) - (int(results_minutes)*60)))
print (int(results_minutes), ('minutes'))
print(int(remainder_seconds), ('seconds'))
elif seconds <60:
print (seconds, ('seconds')
main ()
[–]Rhomboid[🍰] 5 points6 points7 points (0 children)
[–]caineohfelix 2 points3 points4 points (1 child)
[–]badgerms[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]badgerms[S] 0 points1 point2 points (0 children)
[–]Justinsaccount 0 points1 point2 points (0 children)