TASK
Unit Conversion Functions
Create three Python functions for different unit conversions based on the below:
1. Temperature conversion (Celsius to Fahrenheit), rounded to 2 decimal places. Use the round() function to help with this.
2. Distance conversion (Miles to Kilometers), rounded to 2 decimal places. Use the round() function to help with this.
3. Time conversion (Hours and Minutes to Total Minutes)
Function Specifications:
1. celsius_to_fahrenheit(celsius)
Input: Temperature in Celsius (float)
Output: Temperature in Fahrenheit (float)
Formula: F = (C * 9/5) + 32
2. miles_to_kilometers(miles)
Input: Distance in miles (float)
Output: Distance in kilometers (float)
Formula: km = miles * 1.60934
3. time_to_minutes(hours, minutes)
Input: Time in hours (int) and minutes (int)
Output: Total time in minutes (int)
Formula: total_minutes = (hours * 60) + minutes
Task Requirements:
1. Implement the three functions as specified above.
2. Write a main section that demonstrates the usage of each function at least once.
3. Round the results of celsius_to_fahrenheit() and miles_to_kilometers() to two decimal places.
4. Use descriptive variable names and add comments to explain your code.
Example Starting Code:
def celsius_to_fahrenheit(celsius):
# Implement the function here
def miles_to_kilometers(miles):
# Implement the function here
def time_to_minutes(hours, minutes):
# Implement the function here
celsius = # get input for celsius
fahrenheit = celsius_to_fahrenheit(celsius)
print(f"{celsius}C is equal to {fahrenheit}F")
miles = # get input for miles
km = miles_to_kilometers(miles)
print(f"{miles} miles is equal to {km} kilometers")
hours = # get input for hours
minutes = # get input for minutes
total_minutes = time_to_minutes(hours, minutes)
print(f"{hours} hours and {minutes} minutes is equal to {total_minutes} minutes")