0% found this document useful (0 votes)
11 views

Computer Assignment

Uploaded by

tubecreativity
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Computer Assignment

Uploaded by

tubecreativity
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Question 1

Write a Python program to input a


distance in meters and convert it to
kilometres.

Solution
# Python program to convert meters to kilometres

# Taking input from the user


meters = float(input("Enter distance in meters: "))

# Converting meters to kilometres


kilometres = meters / 1000

# Displaying the result


print(f"{meters} meters is equal to {kilometres} kilometres")
Question 2
Write a Python program to input a
temperature in Fahrenheit and convert it to
Celsius.

Solution
# Python program to convert Fahrenheit to Celsius

# Taking input from the user


fahrenheit = float(input("Enter temperature in Fahrenheit: "))

# Converting Fahrenheit to Celsius


Celsius = (fahrenheit - 32) * 5 / 9

# Displaying the result


print(f"{fahrenheit}°F is equal to {celsius:.2f}°C")
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
Question 9
Question 10

You might also like