sync
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
def windchill_table(formula):
|
||||
|
||||
#print header columns
|
||||
print("\t", end="")
|
||||
for temp in range(-20, 61, 10):
|
||||
print(f"{temp}\t", end="")
|
||||
print("\n-----------------------------------------------------------------------------") # Print the dang header and Add a newline after the temperature header
|
||||
|
||||
for v in range(0, 51, 5):
|
||||
print(f"{v}\t", end="") # Print wind speed
|
||||
for temp in range(-20, 61, 10): # loop through the temp range to add a value to each cell
|
||||
# Calculate windchill using the provided formula
|
||||
windchill = 35.74 + 0.6215 * temp - 35.75 * (v ** 0.16) + 0.4275 * temp * (v ** 0.16)
|
||||
if v == 0:
|
||||
print ("N/A\t", end="") # Print N/A for wind speed 0
|
||||
else:
|
||||
print(f"{windchill:.2f}\t", end="") # Print windchill with one decimal place
|
||||
print() # Add a newline after each row of windchill values
|
||||
|
||||
def main():
|
||||
print("This program computes the windchill index.")
|
||||
print("print a table to show the windchill index for a range of temperatures and wind speeds.")
|
||||
windchill_table(0)
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user