0

I am trying to make a menu (only 25% complete as of now) and whenever I input a number for example 3, the list z outputs a value of z = ['']

print("Welcome to Kushagra's Pizzeria!")
z = []
a = ""
print('''
Please select a size-
                      1.Small
                      2.Medium
                      3.Large
''')
y = input("-->")
if y == 1:
    a = "Small"
elif y == 2:
    a = "Medium"
elif y == 3:
    a = "Large"
z.append(a)
print(z)
quamrana
  • 33,740
  • 12
  • 54
  • 68

2 Answers2

1

You either convert the input to int or look for the string value

y == "1"

or

int(input("-->"))
quamrana
  • 33,740
  • 12
  • 54
  • 68
Daniel
  • 4,647
  • 4
  • 32
  • 46
0

input() returns a string. you need to convert it to an integer by calling the int method

y = int(input("-->"))
quamrana
  • 33,740
  • 12
  • 54
  • 68
ranifisch
  • 1,727
  • 1
  • 11
  • 22