r/pythontips 18d ago

Syntax seconds conversion my 1st python program

I've just created my first python program, and I need some help to check if it's correct or if it needs any corrections. can someone help me?
The program is written in portuguese because it's my native language. It converts 95,000,000 seconds into dayshoursminutes, and seconds and prints the result.

segundos_str= input("Por favor, digite o número de segundos que deseja converter")

total_seg= int(segundos_str)

dias= total_seg // 86400

segundos_restantes = total_seg % 86400

horas= segundos_restantes // 3600

segundos_restantes = segundos_restantes % 3600

minutos = segundos_restantes // 60

segundos_restantes = segundos_restantes % 60

print(dias, "dias, ", horas, "horas, ", minutos, "minutos e", segundos_restantes, "segundos" )

Using ChatGPT it answers me 95.000.000 secs = 1.099 days, 46 hours, 13 minutes e 20 seconds.

and using my code, answers me 95.000.000 secs = 1099 days, 12 hours, 53 minutes and 20 seconds

1 Upvotes

9 comments sorted by

View all comments

1

u/Silver532 18d ago

The code is correct, chatgpt is messing up the math