-2
if hello > 2 and < 55:
    print hello

Why doesn't this peace of code work? I know it's really basic but I cannot understand or find an answer on the internet why this isn't working, despite looking for the last 20 minutes.

This is python version 2.7.3.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

2 Answers2

3

It should be (well one way of doing it):

hello = 3
if 2 < hello < 55:
    print hello
Dair
  • 15,910
  • 9
  • 62
  • 107
  • 2
    Protip: This is a nice feature in Python, but this does not work in many other languages, this is like the #1 reposted question for new C++ programmers! (@anon you are perfectly correct btw, just thought in case someone saw this in the future I should forewarn them). – Cory Kramer Jun 04 '14 at 20:25
1
if hello > 2 and hello < 55:
    print hello
Andres
  • 4,323
  • 7
  • 39
  • 53