def validate(bpp):
for i in range(bpp):
if bpp < 3:
raise ValueError("Please have 3 values in the list.")
if bpp[0] != "add":
raise ValueError("Please use 'add','div','sub' or 'mul' along with two numbers.")
if bpp[0] != "div":
raise ValueError("Please use 'add','div','sub' or 'mul' along with two numbers.")
if bpp[0] != "mul":
raise ValueError("Please use 'add','div','sub' or 'mul' along with two numbers.")
if bpp[0] != "sub":
raise ValueError("Please use 'add','div','sub' or 'mul' along with two numbers.")
if bpp[1] != type(int):
raise ValueError("Please put an integer for your first operand.")
if bpp[2] != type(int):
raise ValueError("Please put an integer for your second operand.")
else:
print("Everything is ready to go! Now go evaluate your numbers!")
It's giving me 'str' object cannot be interpreted as an integer for the "for i in range(bpp). I'm trying to get it to see that if there are less than 3 variables in the list bpp, then it will give a ValueError. So something like
validate(["add", 10, 10"])
and it gives me back 20