0
Write a program (in 1 script file) to convert 1000 seconds to minutes and seconds.
how
4 Antworten
+ 10
minutes = 1000 // 60
seconds = 1000 % 60
+ 10
// is floor division i.e. it returns the quotient.
% is remainder i.e. it returns the remainder.
+ 1
you can do that in just one line:
minutes, seconds = divmod(1000,60)
This way, you don't recalculate the division
- 1
how did you know if its // or %