-2

I am trying to make a program that uses text files to sort items using a barcode scanner...but the if statement is not working. You have 2 options:

  1. create new barcode or
  2. scan an existing barcode

but if I put the number in it does not work can anyone please help?

Screenshot of code

martineau
  • 119,623
  • 25
  • 170
  • 301
  • 1
    The `input()` statement returns a string, but you are comparing it to an integer. – John Anderson Jan 17 '20 at 23:14
  • 3
    [Stackoverflow discourages screenshots of code and errors](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors) – DarrylG Jan 17 '20 at 23:25
  • 1
    [Discourage screenshots of code and/or errors](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors) – martineau Jan 18 '20 at 01:22
  • Does this answer your question? [How can I read inputs as numbers?](https://stackoverflow.com/questions/20449427/how-can-i-read-inputs-as-numbers) – AMC Jan 18 '20 at 01:50

1 Answers1

0

Wrapping an int() around your input() should fix your problem.

bdehmer
  • 569
  • 1
  • 6
  • 18