New to Python for Beginners | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

New to Python for Beginners

Just started to learn Python for Beginners. Can someone show me the python statement for how many seconds in 30 days? I was lost in sauce....Thank you! Jesse

30th May 2021, 3:51 AM
J Avalos
J Avalos - avatar
4 Answers
0
Month*30*24*60*60
30th May 2021, 3:57 AM
Eashan Morajkar
Eashan Morajkar - avatar
0
you could something simple like: seconds = 60*60*24*30 the first 60 is total seconds in a minute. the second 60 is total minutes in an hour. multiplying 60 seconds and 60 minutes will give you the total seconds in an hour. 24 is the total number of hours in a day. when you multiply the 24 hours, that will give you all the seconds in a day. 30 is the number of days. this will give you the number of seconds in 30 days. you can replace 30 with another number of days to find out how many seconds are in any number of days.
30th May 2021, 4:00 AM
you are smart. you are brave.
you are smart. you are brave. - avatar
0
thank you!
12th Jun 2021, 5:44 PM
J Avalos
J Avalos - avatar
0
you’re weclome. when you are more familiar with python you could try to create a function. it would look something like this: def seconds_in_a_day(n): return 60*60*24*n if __name__ == “__main__”: seconds = seconds_in_a_day(30) print(seconds)
12th Jun 2021, 5:50 PM
you are smart. you are brave.
you are smart. you are brave. - avatar