In: Computer Science
1. Develop a module named temperatures.py with the following functions.
WC = 35.74+ 0.6215T−35.75V0.16 +0.4275∗T∗V0.16
WC = 13.12+ 0.6215T−11.37V0.16 +0.3965∗T∗V0.16
2. Develop an application in which the user enters lower and upper bounds on temperature in Fahrenheit and lower and upper bounds on wind speed in miles per hour. Two charts are produced. The first chart lists wind chills in Fahrenheit for all combinations of temperature in Fahrenheit and wind speed in miles per hour. The second chart lists wind chills in Celsius for all combinations of equivalent temperatures in Celsius and wind speeds in kilometers per hour.
Required Code Structures:
Make sure to add the temperatures.py in the modules directory
Code for the app:
import temperatures
def display(temp_upper,temp_lower,speed_upper,speed_lower):
# For listing the data in farenheit and MPH
for i in range(int(temp_lower),int(temp_upper)):
for j in range(int(speed_lower),int(speed_upper)):
print(i,j) # Prints the value of Temp and Wind speen in farenheit and MPH Respectively
print(windchillF(i,j)) # Prints the value of Wind Chill
# For listing the data in celcius and KPH
for i in range(int(toCelsius(temp_lower)),int(toCelsius(temp_upper))):
for j in range(int(toKPH(speed_lower)),int(toKPH(speed_upper))):
print(i,j) # Prints the value of Temp and Wind speen in celcius and KPH Respectively
print(windchillc(i,j)) # Prints the value of Wind Chill
def main():
temp_upper = input("Enter the upper bound for temperature in Fahrenheit:")
temp_lower = input("Enter the lower bound for temperature in Fahrenheit:")
speed_upper = input("Enter the upper bound for Wind Speed in MPH:")
speed_lower = input("Enter the lower bound for Wind Speed in MPH:")
display(temp_upper,temp_lower,speed_upper,speed_lower)
main()
Code for temperature.py module:
def toCelsius(fahrenheit):
return (5/9) * (fahrenheit - 32)
def toFahrenheit(celsius):
return (celsius * 1.8) + 32
def toKPH(mph):
return mph * 1.609344
def toMPH(kph):
return kph * 0.62137119
def windchillF(T,V):
return (35.74 + 0.6215*T - 35.75 * V **0.16 + 0.4275 * T * V**0.16)
def windchillC(T,V):
return (13.12 + 0.6215*T - 11.37 * V **0.16 + 0.3965 * T * V**0.16)