Python function with no arguments but with a return value (epoch time)

preview_player
Показать описание
This video shows how the current time can be returned from a user defined function that uses the epoch time as the basis of its mechanics.
Рекомендации по теме
Комментарии
Автор

I think you are the BEST programming instructor I have ever heard. You go slow, you use great analogies and you explain to the correct level of depth. Thank You so much for sharing. You should consider writing some books to go along with these videos.

snamone
Автор

amazing the way you explain this watch all your videos with great pleasure

PR-tjtm
Автор

I really enjoy learning from you! Your videos help me pick up secondary bits here and there while you make the main theme completely transperent. Pleasure!

Sound of the video is low though comapared to other sound settings I have simultaniously in my PC.

Great content and apprach. I will continue watching you anyway! Hapy to have met you! I am recomending you to othres.

kreteniol
Автор

i used the code given in the program but got the wrong result for the hour i cant figure it out after hours of try to wrap my head around this can you please help?

import time
def get_time():
epoch_time = time.time()
total_seconds = int(epoch_time)
current_second = total_seconds%60
total_minutes = total_seconds//60
current_minutes = total_minutes%60
total_hours = total_minutes//60
current_hour = total_hours%24
current_time = str(current_hour) + ":" + str(current_minutes) + ":"+ str(current_second)

return current_time

print(get_time())

i should get 21 in the hour but am getting 16 at 9 PM

sanaullahkhanhassanzai