New Coder simple time clock
<p>I need help trying to solve this problem in python</p>

<p>You must write a program asking for the current time <code>(hours only)</code> and an amount of hours in the future. Use the modulo <code>%</code> operator to tell the time traveler the future hour to which they will be traveling.</p>

<p>the tricky part for me is how do you make the time reset after 24</p>

<p>edit</p>

<pre><code>`#TODO 1: Ask for user input
hour=input("what time is it?")
time_traveled=input("how many hours would you like to travel")
hr=int(hour)
tt=int(time_traveled)`
`#TODO 2: Calculate the future hour
futurehr=hr+tt
if futurehr%24 == 0:
    finalHr=futurehr
else:annoyinghr=futurehr
    days=annoyinghr%24*24
if annoyinghr%24 &gt; 0:
    finalHr=annoyinghr-days`
</code></pre>

<p>sorry about not posting the code, I think my problem is I dont understand the <code>%</code> well enough </p>

<p>thank you in advance</p>

<p>It seems like you're making your code more complicated than necessary:</p>

<pre><code># TODO 1: Ask for user input
hour = int(input("What time is it? "))
time_traveled = int(input("How many hours would you like to travel? "))

#TODO 2: Calculate the future hour
future_hour = (hour + time_traveled) % 24

print("You will arrive in the future at", future_hour, "o'clock")
</code></pre>

<p>If the above isn't sufficient, please edit your description to say what further processing needs to be done to the result.  If it is sufficient, the above isn't finished code --  it really should handle possible bad, non-numeric or out of range input via explicit tests and <code>try ... except</code> clauses.</p>

python