The temperature of ethanol in degrees Celsius is read from input into integer variable val. If val is:< -113 degrees Celsius, output "The ethanol is now a solid."≥ -113 degrees Celsius and < 79 degrees Celsius, output "The ethanol is now a liquid."Otherwise, output "The ethanol is now a gas." End each output with a newline.
Question
The temperature of ethanol in degrees Celsius is read from input into integer variable val. If val is:< -113 degrees Celsius, output "The ethanol is now a solid."≥ -113 degrees Celsius and < 79 degrees Celsius, output "The ethanol is now a liquid."Otherwise, output "The ethanol is now a gas." End each output with a newline.
Solution
Sure, here is the step by step solution:
-
First, you need to read the temperature of ethanol from the input into an integer variable
val. This can be done using theinput()function and then converting the input to an integer using theint()function. For example:val = int(input()). -
Next, you need to check if
valis less than -113. This can be done using anifstatement. For example:if val < -113:. If this condition is true, then you need to output "The ethanol is now a solid." This can be done using theprint()function. For example:print("The ethanol is now a solid."). -
If the first condition is not true, then you need to check if
valis greater than or equal to -113 and less than 79. This can be done using anelifstatement. For example:elif -113 <= val < 79:. If this condition is true, then you need to output "The ethanol is now a liquid." This can be done using theprint()function. For example:print("The ethanol is now a liquid."). -
If neither of the first two conditions are true, then you need to output "The ethanol is now a gas." This can be done using an
elsestatement. For example:else:. Then you can use theprint()function to output the message. For example:print("The ethanol is now a gas."). -
Each output ends with a newline by default when using the
print()function, so you don't need to do anything extra for that.
Here is the complete code:
val = int(input())
if val < -113:
print("The ethanol is now a solid.")
elif -113 <= val < 79:
print("The ethanol is now a liquid.")
else:
print("The ethanol is now a gas.")
Similar Questions
Test tubes containing ethanol have been placed in a water bath.The water bath has only just been switched on. The temperature of the water was recorded as it was heating up.Ethanol has a melting point of -114 °C and a boiling point of 78 °C.Identify the state of matter ethanol will be after 60 seconds.SolidGasLiquid
Ethanol has a melting point of -114 °C and a boiling point of 78 °C.Which state of matter would ethanol be with a temperature of -208 °C?SolidLiquidGas
Use the heating curve of ethanol below to answer the questions that follow.QUESTIONS:Segment A represents the heating of ethanol in the _______________ phase.Segment B represents the _______________ of ethanolSegment C represents the heating of ethanol in the _______________ phase.Segment D represents the _______________ of ethanolSegment E represents the heating of ethanol in the _______________ phase.What is the boiling point of ethanol? _______________ What is the condensing point of ethanol? _______________ What is the freezing point of ethanol? _______________ What is the melting point of ethanol? _______________ The average kinetic energy (aka temperature) is changing during these three segments: _______________ The heat added during the three sections mentioned in the question above is being used to _______________ (increase the temperature/change the phase) of ethanol.The average kinetic energy (aka temperature) is constant during these two segments: _______________ The heat added during the two sections mentioned in the question above is being used to _______________ (increase the temperature/change the phase) of ethanol.
Write code that allow the user to enter the temperature in degrees Celsius. The program should convert it and print it in Fahrenheit degrees using the following formula: Fahrenheit = (Celsius * 9/5) + 32 For example, if the user enters 0, then the program will print "Temperature in Fahrenheit: 32.0"
Calculate the energy required to heat 795.0mg of ethanol from −2.4°C to 14.6°C. Assume the specific heat capacity of ethanol under these conditions is ·2.44J·g−1K−1 . Be sure your answer has the correct number of significant digits.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.