Q. Write a python script that ask the user to enter a length in centimeters. If the user enters a negative length, the program should tell the user that the entry is invalid. otherwise, The program should convert the length to inches and print out the result. there are 2.54 centimeters in an inch.
You can understand by Watching video :-
Answer :-
a = int(input("Enter the length in centimeter = ")) if a < 0 : print("Invalid") else : print("Length in inch = ",a/2.54)
Output :-
Enter the length in centimeter = -463
Invalid
>>>
Enter the length in centimeter = 565
Length in inch = 222.44094488188975
>>>
Enter the length in centimeter = 52
Length in inch = 20.47244094488189
>>>
thank you so much. this helped me in my homework :)
ReplyDeleteWelcome : )
Deletecan you pls solve my doubts also i really need help
ReplyDeleteWhat is your doubt ?
DeleteAuto subscribe
ReplyDeletefrom PH heheheh thankyou
Welcome : )
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )