not able to compare a int to a Literal[] python


This Content is from Stack Overflow. Question asked by YelloElefant

leftLdr = machine.ADC(26) #bottom pin
rightLdr = machine.ADC(27) #top pin

while True:
  readingLeft = leftLdr.read_u16()
  readingRight = rightLdr.read_u16()

  print("ADC: ", readingLeft, readingRight) 

  if(readingRight > 2000):

the if statement gives the error

Operator “>” not supported for types “int” and “Literal[2000]”


Check the Answers

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?