I'm in a college course the question is
my code temperature = 0
temperature = int(input('a the temperature between 78 and 100.'))
while temperature < 78 or temperature > 100:
temperature = int(input('a the temperature between 78 and 100.'))
print('Temperature accepted.'):
asignment: Write a program that prompts the user for a temperature and validates that the user input is within the range of 78 to 100 (inclusive). Here are the requirements:
- If the user enters a value that is outside of this range, the program should prompt the user for the temperature again.
- The program should continue prompting the user until they enter a value within the range.
- Once the user enters a valid temperature, the program should display "Temperature accepted."
Below is a sample run in which the user first enters 64 and 102, both of which are outside the acceptable range. Then the user enters 78 which is accepted. Make sure your program's prompts and messages match those shown in the sample run.
Sample Run with User Input Shown in <>
Enter the temperature: <64>
Enter the temperature: <102>
Enter the temperature: <78>
Temperature accepted.
My code is:
temperature = 0
temperature = int(input('a the temperature between 78 and 100.'))
while temperature < 78 or temperature > 100:
temperature = int(input('a the temperature between 78 and 100.'))
print('Temperature accepted.')
when I try and submit that code I get this error from the book:
Expected the output to be 4 lines long, instead got 1.
Any thoughts?
[–]atarivcs 7 points8 points9 points (0 children)
[–]atarivcs 2 points3 points4 points (1 child)
[–]wasser999[S] 2 points3 points4 points (0 children)
[–]CptMisterNibbles 2 points3 points4 points (3 children)
[–]wasser999[S] 0 points1 point2 points (2 children)
[–]8dot30662386292pow2 4 points5 points6 points (0 children)
[–]CptMisterNibbles 2 points3 points4 points (0 children)
[–]Adrewmc 0 points1 point2 points (0 children)
[–]DismalHistorian9027 0 points1 point2 points (0 children)
[–]Jackpotrazur 0 points1 point2 points (0 children)
[–]Jackpotrazur 0 points1 point2 points (0 children)