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
  • 37,849
  • 12
  • 53
  • 71

2 Answers2

1

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

y == "1"

or

int(input("-->"))
quamrana
  • 37,849
  • 12
  • 53
  • 71
Daniel
  • 5,095
  • 5
  • 35
  • 48
0

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

y = int(input("-->"))
quamrana
  • 37,849
  • 12
  • 53
  • 71
nonamer92
  • 1,887
  • 1
  • 13
  • 24