3. Write a python program to calculate the number of even and odd numbers from a
The output is:
Please input the temperature for convert (e.g:101C, 30F): 40C
Expected Answer:
The temperature in Fahrenheit is 104 degrees.
Sample Answer:
temp_input = input("Please input the temperature for convert (e.g:101C, 30F): ") num_input = int(temp_input[:-1]) initial_letter = temp_input[-1] if initial_letter.upper() == "C": result = int(round((9 * num_input) / 5 + 32)) final_letter = "Fahrenheit" elif initial_letter.upper() == "F": result = int(round((num_input - 32) * 5 / 9)) final_letter = "Celsius" quit() print("The temperature in", final_letter , "is", result, "degrees.")
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)