0

Write a program (in 1 script file) to convert 1000 seconds to minutes and seconds.

how

5th May 2017, 2:07 AM
AidilSha 6
AidilSha 6 - avatar
4 odpowiedzi
+ 10
minutes = 1000 // 60 seconds = 1000 % 60
5th May 2017, 2:21 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 10
// is floor division i.e. it returns the quotient. % is remainder i.e. it returns the remainder.
5th May 2017, 2:35 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 1
you can do that in just one line: minutes, seconds = divmod(1000,60) This way, you don't recalculate the division
5th May 2017, 10:02 PM
Amaras A
Amaras A - avatar
- 1
how did you know if its // or %
5th May 2017, 2:30 AM
AidilSha 6
AidilSha 6 - avatar