Answer
Step 3 of 3
Sample Output:
Enter the amount of water in kilograms: $55.5$
Enter the initial temperature: $3.5$
Enter the final temperature: $10.5$
The energy needed is $1625484.0$
Work Step by Step
Step 1 of 3
Program Plan:
Create a python file with name 2_8PE.PY. In the file,
- Get input from user. It is the weight of water in kilograms.
- Also prompt the user for initial and final temperature of water individually.
- Calculate energy required to heat water from the given initial to final temperature.
- Display the energy required to heat water from the given initial to final temperature.
Step 2 of 3
Program:
# Prompt the user for water in kilograms
mass $=$ eval(input (
"Enter the amount of water in kilograms: "))
# Prompt the user for initial temperature
initialTemp = eval(input(
"Enter the initial temperature: "))
# Prompt the user for final temperature
finalTemp = eval(input("Enter the final temperature: "))
# Calculate energy required to heat water from initial
#to final temperature
energy $=$ mass $^{*}(\text { finalTemp }-\text { initialTemp })^{*} 4184$
#Display the energy required
print("The energy needed is ", energy)
Step 3 of 3
Sample Output:
Enter the amount of water in kilograms: $55.5$
Enter the initial temperature: $3.5$
Enter the final temperature: $10.5$
The energy needed is $1625484.0$