0

I have been trying to put two options in an if statement but it never comes up with the correct variable.

if size == "8" or 10:
  size_cost = 0
else:
  size_cost = 2
print(size_cost)

When the user puts in a number that is bigger that 10 it should print out 2 but what it actaally prints out is 0. Can someone help please?

2 Answers2

1
if size == "8" or size == "10":
  size_cost = 0
else:
  size_cost = 2
print(size_cost)

Are you sure though that your variable size is a string and not an int? You may want to double check this. In this case, you want:

if size == 8 or size == 10:
  size_cost = 0
else:
  size_cost = 2
print(size_cost)
Alex Metsai
  • 1,837
  • 5
  • 12
  • 24
0

need to include the size after the or

 if size == 8 or size == 10:
      size_cost = 0
    else:
      size_cost = 2
    print(size_cost)