I was trying to use an "Input" function to prompt a user to select an option.
print("1. Default Data Sheet\n2. Upload Data Sheet\nE. Exit")
option = input("Please select an option: ")
while option != "E" and int(option) < 1 or int(option) > 2: 
    option = input("Please select a valid option: ")
if int(option) == 1:
    dataset = pd.read_csv("portfolioStock.csv")
    with open("portfolioStock.csv", newline='') as file: 
        for row in csv.reader(file):
            stock.append(row)
elif int(option) == 2:
    filename = input("Please enter filename with the extension:")
    dataset = pd.read_csv(filename)
    with open(filename, newline='') as file:
        for row in csv.reader(file):
            stock.append(row)
elif option == "E":
    print("Press enter to return to menu.")
However when I debug the code, input 1 and 2 works well but an input E generated an error message "ValueError: invalid literal for int() with base 10: 'E'" I have tried to print out the type of my input and it gives me "str" as expected. So I have no idea where my code goes wrong. Can anyone help me with this issue?
 
     
    