Python Program Collection 05 - Convert temperature in Fahrenheit , celcisus, convert IC to NC, Dollar to NC, km to M
56. To accept temperature in Fahrenheit
from user and convert into the Celsius.
fahrenheit = float(input("Enter
Temperature in Fahrenheit: "))
celsius = (fahrenheit - 32) * 5 / 9
print("Temperature in Celsius:",
celsius)
57. To accept temperature in Celsius
from user and convert into the Fahrenheit.
fah = float(input("Enter Temperature in
Fahrenheit: "))
cel = (fah - 32) * 5 / 9
print("Temperature in Celsius:",
cel)
58. To accept currency value in nepalese
rupees and convert into indian currency
npr = float(input("Enter amount in
Nepalese Rupees (NPR): "))
inr = npr / 1.6
print("Equivalent amount in Indian Rupees
(INR):", inr)
59. To accept currency value in indian
currency and convert into nepalese rupees
inr = float(input("Enter amount in Indian
Rupees (INR): "))
npr = inr * 1.6
print("Equivalent amount in Nepalese
Rupees (NPR):", npr)
60. To accept currency value in dollar
and convert into nepalese rupees
usd = float(input("Enter amount in US
Dollars (USD): "))
npr = usd * 133
print("Equivalent amount in Nepalese
Rupees (NPR):", npr)
61. To accept currency value in nepalese
rupees and convert into dollar.
npr = float(input("Enter amount in
Nepalese Rupees (NPR): "))
usd = npr / 133
print("Equivalent amount in US Dollars
(USD):", usd)
62. Input days and
convert into years, months and days.
days =
int(input("Enter number of days: "))
years = days // 365
remaining_days = days
% 365
months =
remaining_days // 30
days_left =
remaining_days % 30
print("Years:",
years)
print("Months:",
months)
print("Days:",
days_left)
63. Input seconds and
convert into hours minutes and seconds.
seconds =
int(input("Enter time in seconds: "))
hours = seconds //
3600
remaining_seconds =
seconds % 3600
minutes =
remaining_seconds // 60
seconds_left =
remaining_seconds % 60
print("Hours:",
hours)
print("Minutes:",
minutes)
print("Seconds:",
seconds_left)
64. Input distance in
kilometer and convert into meter.
km =
float(input("Enter distance in kilometers: "))
m = km * 1000
print("Distance
in meters:", m)
65. Input distance in
meter and convert into kilometer and meter.
m =
float(input("Enter distance in meters: "))
km = m / 1000
print("Distance
in kilometers:", km)
No comments:
Post a Comment