Unsupported operand in if/else statement error in Python

user2976193

I am a newbie to Python, what am I doing wrong?

if p1_teller == 0 & p1_raw[0:1] != "/":
    print "Loop 1"
else:
    print "Loop 2"

Then I get the following error:

TypeError: unsupported operand type(s) for &: 'int' and 'str'

Tim

Python uses and for logical and. & is a bitwise and. Change your code to:

if p1_teller == 0 and p1_raw[0:1] != "/":
    print "Loop 1"
else:
    print "Loop 2"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Python Type Error Unsupported Operand

From Dev

Type error: unsupported operand

From Dev

Unsupported operand type in Python

From Dev

Python Error TypeError: unsupported operand type(s) for +: 'function' and 'function'

From Dev

Python Error: unsupported operand type(s) for +: 'int' and 'NoneType'

From Dev

Python Error : unsupported operand type(s) for +: 'int' and 'datetime.timedelta'

From Dev

python error; unsupported operand type(s) for +: 'int' and 'str'

From Dev

Python Error: unsupported operand type(s) for +: 'int' and 'NoneType'

From Dev

Python error: unsupported operand type(s) for -: 'float' and 'NoneType'

From Dev

TypeError: unsupported operand type in Python

From Dev

Unsupported operand type(s) for +: 'float' and 'str' error

From Dev

Euclidean Distance Error: unsupported operand type

From Dev

Error message: unsupported operand type(s) for ___

From Dev

Unsupported operand type(s) for *: 'NoneType' and 'NoneType' (Python)

From Dev

TypeError: unsupported operand int and NoneType? Python

From Dev

Python - Unsupported Operand type(s) for +: 'int' and 'list'

From Dev

Python - Unsupported Operand Type(s) for -: 'int' and 'str'

From Dev

Python: unsupported operand type(s) for /: 'tuple' and 'float'

From Dev

Unsupported operand types for bitwise exclusive OR in Python

From Dev

python sqlite executemany statement error: ValueError: parameters are of unsupported type

From Dev

Solving "error: Unsupported left operand type for + ("Iterable[str]") [operator]"

From Dev

Unsupported Operand Type Error with scipy.optimize.curve_fit

From Dev

Unsupported operand types error when declaring default params as INF

From Dev

Django-cms error "unsupported operand type(s) for +: 'set' and 'tuple'"

From Dev

Unsupported operand type error when trying to multiply function parameter by an integer

From Dev

Solving "error: Unsupported left operand type for + ("Iterable[str]") [operator]"

From Dev

Unsupported Operand Type Error with scipy.optimize.curve_fit

From Dev

Django-cms error "unsupported operand type(s) for +: 'set' and 'tuple'"

From Dev

getting error unsupported operand type(s) for +: 'int' and 'str'

Related Related

  1. 1

    Python Type Error Unsupported Operand

  2. 2

    Type error: unsupported operand

  3. 3

    Unsupported operand type in Python

  4. 4

    Python Error TypeError: unsupported operand type(s) for +: 'function' and 'function'

  5. 5

    Python Error: unsupported operand type(s) for +: 'int' and 'NoneType'

  6. 6

    Python Error : unsupported operand type(s) for +: 'int' and 'datetime.timedelta'

  7. 7

    python error; unsupported operand type(s) for +: 'int' and 'str'

  8. 8

    Python Error: unsupported operand type(s) for +: 'int' and 'NoneType'

  9. 9

    Python error: unsupported operand type(s) for -: 'float' and 'NoneType'

  10. 10

    TypeError: unsupported operand type in Python

  11. 11

    Unsupported operand type(s) for +: 'float' and 'str' error

  12. 12

    Euclidean Distance Error: unsupported operand type

  13. 13

    Error message: unsupported operand type(s) for ___

  14. 14

    Unsupported operand type(s) for *: 'NoneType' and 'NoneType' (Python)

  15. 15

    TypeError: unsupported operand int and NoneType? Python

  16. 16

    Python - Unsupported Operand type(s) for +: 'int' and 'list'

  17. 17

    Python - Unsupported Operand Type(s) for -: 'int' and 'str'

  18. 18

    Python: unsupported operand type(s) for /: 'tuple' and 'float'

  19. 19

    Unsupported operand types for bitwise exclusive OR in Python

  20. 20

    python sqlite executemany statement error: ValueError: parameters are of unsupported type

  21. 21

    Solving "error: Unsupported left operand type for + ("Iterable[str]") [operator]"

  22. 22

    Unsupported Operand Type Error with scipy.optimize.curve_fit

  23. 23

    Unsupported operand types error when declaring default params as INF

  24. 24

    Django-cms error "unsupported operand type(s) for +: 'set' and 'tuple'"

  25. 25

    Unsupported operand type error when trying to multiply function parameter by an integer

  26. 26

    Solving "error: Unsupported left operand type for + ("Iterable[str]") [operator]"

  27. 27

    Unsupported Operand Type Error with scipy.optimize.curve_fit

  28. 28

    Django-cms error "unsupported operand type(s) for +: 'set' and 'tuple'"

  29. 29

    getting error unsupported operand type(s) for +: 'int' and 'str'

HotTag

Archive