Computer Science, asked by shivangisudha, 5 months ago

1. Write a Python script that asks the user to enter
a length in centimetres. 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
centimetres in an inch.​

Answers

Answered by namitha12346
0

Answer:

here is your Answer

Explanation:

mark me as brilliant and thank my all Answers

Attachments:
Answered by anindyaadhikari13
1

Required Answer:-

Question:

  • Write a Python script to convert length from centimeters to inches.

Solution:

Here comes the program.

n=float(input("Enter length in centimeters: "))

if n<0:

print("Invalid Input.")

else:

x=n/2.54

print(n,"centimeters =",x,"inches")

Algorithm:

  1. START.
  2. Ask the user to enter length in cm.
  3. If length is negative, display an error message or else, convert length from cm to inches and display the result.
  4. STOP.

See the attachment for output ☑.

Attachments:
Similar questions