-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
  • 963,270
  • 265
  • 3,804
  • 3,187

2 Answers2

3

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

hello = 3
if 2 < hello < 55:
    print hello
Dair
  • 15,412
  • 8
  • 59
  • 104
  • 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,061
  • 6
  • 36
  • 52