0

something like to match any number greater than x or less than x:

match num:
    case > 1:
        print('more than 1')

does this exist in python?

points = 4    
match points:
    case 0:
        print(0)
    case 1:
        print(1)
    case 2:
        print(2)
    case 3:
        print(3)
    case ( > 3):
        print('more than 3')
    case ( < -2):
        print('less than -2')

this doesn't work:

    case ( > 3):
           ^
SyntaxError: invalid syntax
Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
brozorb
  • 3
  • 2

0 Answers0