New to Python Question on operators

I cannot figure out how to fix this simple input.

import time

import random

while True:

a1 = int(input('What is the temperature?'))

if a1 >= 85:

    print('That is too hot')

elif a1 >= 55 and < 85

print('That is perfect')

elif a1 < 55:

    print('Too cold')

I figured it out. By having the >= 55 and < 85 in the statement it was causing the error. This is because i am already covered by the >= 85 statement and it was not needed.

I rewrote the code to this and it works fine:

while True:

a1 = int(input('What is the temperature?'))

if a1 >= 85:

    print('That is too hot')

elif a1 >= 55:

    print('That is perfect')

elif a1 < 55:

    print('Too cold')

I also just figured out you can do it this way as well.

while True:

a1 = int(input('What is the temperature? '))

print('That is too hot') if a1 >= 85 else print(

    'That is perfect') if a1 >= 55 else print('Too cold')
1 Like