Basic Python Program-12

Write a python program that asks the user to enter a length in centimeter. 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.(2.54=1 inch)



x=int(input("Enter the length in centimeter"))

try:
    assert x>0

    inch=x/2.54
    print("The length in inch is  ",inch)

except AssertionError:
    print("The length is invalid")