0

I don't understand what is wrong with my code, the if statements are being skipped, please help me.

import sys

print("-_-_-_-_-_-_-_-_-_-_-_-_- T Data Analysis Pro -_-_-_-_-_-_-_-_-_-_-_-_-\n\n");

OpCode = 1
while OpCode != 0:
    Prompt = "Enter your desired Operation:\n" \
         "0 : Exit\n" \
         "1 : Read T Data File\n" \
         "2 : Provide Analysis on an Item\n" \
         "TDA >> "
    OpCode = input(Prompt)
    print("\n[Debug] Input = ",OpCode,"\n")
    if OpCode == 0:
        print("Bye!")
        break
    if OpCode == 1:
        filename = input("\nEnter target filename to parse:")
        print("\n***************** Not Implemented ******************\n")
    if OpCode == 2:
        itemname = input("\nEnter Item Name: ")
        print("\n *********************** You Just Wait .... ************************\n")

1 Answers1

0

input returns a string in python3, so you have to explicitly convert it to an int

OpCode = int(input(Prompt))
danidee
  • 9,298
  • 2
  • 35
  • 55