Make a function to convert any number into hours and minutes. (For example, 71 will become “1 hour, 11 minutes; 133 will become | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Make a function to convert any number into hours and minutes. (For example, 71 will become “1 hour, 11 minutes; 133 will become

This is what I tried: def convertor(): minutes = 350 hours = 60 print(minutes//hours) print(minutes%hours) convertor()

4th Oct 2021, 5:07 PM
Msawenkosi Zuma
2 Answers
+ 5
Msawenkosi Zuma , taking your code and clean it up will be: def convertor(minutes): print(minutes // 60) print(minutes % 60) minutes = int(input()) convertor(minutes) happy coding!
4th Oct 2021, 5:41 PM
Lothar
Lothar - avatar
0
You don't have to make a variable hours just use number 60 this might help print(str(minutes//60)+" hours "+str(minutes%60)+" minutes") also try making the function take an input as an argument so it doesn't convert 350 minutes all the time
4th Oct 2021, 5:16 PM
Melek
Melek - avatar