# New to Python Question on operators

**URL:** <https://forum.codewithmosh.com/t/new-to-python-question-on-operators/7743>\
**Category:** Python\
**Created:** [October 4, 2021, 12:29pm UTC](https://forum.codewithmosh.com/t/new-to-python-question-on-operators/7743 "2021-10-04T12:29:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahawes](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@ahawes](https://forum.codewithmosh.com/u/ahawes)\
**Post date:** [October 4, 2021, 12:29pm UTC](https://forum.codewithmosh.com/t/new-to-python-question-on-operators/7743/1 "2021-10-04T12:29:37Z")

</div>

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')
```

---

<div class="post-metadata">

**Author:** ![ahawes](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@ahawes](https://forum.codewithmosh.com/u/ahawes)\
**Post date:** [October 4, 2021, 1:34pm UTC](https://forum.codewithmosh.com/t/new-to-python-question-on-operators/7743/2 "2021-10-04T13:34:50Z")

</div>

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')
```

---

<div class="post-metadata">

**Author:** ![ahawes](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@ahawes](https://forum.codewithmosh.com/u/ahawes)\
**Post date:** [October 4, 2021, 4:25pm UTC](https://forum.codewithmosh.com/t/new-to-python-question-on-operators/7743/3 "2021-10-04T16:25:13Z")

</div>

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')
```
