+ 1
Hello, can anybody help me with this code
# your program needs to output the number of hours and then the number of remaining minutes on separate lines # given : 888 mins I am trying this program with user input. but it is showing me typeerror. pls help code: mins = (input("enter the minutes:")) hours = (input("enter the hours:")) mins=(mins//hours) hours=(mins%hours) print("number of hours is",mins ) print("number of minutes remaining is",hours)
3 ответов
+ 5
Prajakta ,
additionally to the already given hints, we have to follow the requirements of code coach exercises.
▪︎all code coach exercises are tested by a program that passes values for the various test cases and that receives results from the code. this will work perfectly, as long
as only the demanded inputs and / or outputs are used in our codes.
▪︎so please do not use any *user prompt* with the input function, and only print the required results without additional output.
happy coding!
+ 3
In python, Defaultly input is if string type. So you need to convert to needed type..
If input is int type then convert to int by
mins=int( input() )
hours= int( input() )
+ 2
Use:
x=input() for string not for integers...
Use:
x=int(input()) or float(input())
for integers and floats:-(decimals)