Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Python program that sorts a lists of temperatures input by the user and returns the highest one.
# I wrote this main() to call the highest_temperature function above.
def main():
"""Create a list of temperatures and call a function to find the highest."""
# Initialize the temperature list.
some_temps = ["", "", "", "", "", ""]
# For each index in 'some_temps' get a temperature from the user.
for i in range(len(some_temps)):
some_temps[i] = float(input("Give me a random temperature from the last few weeks: "))
# Set highest_temp equal to the returned value from
# the highest_temperature function.
highest_temp = highest_temperature(some_temps)
# Print the highest temperature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.