I'm having issues with my python code getting syntax error after adding an elif statement and I'm unable to get the reason why, no indentation issues are present in my code
# Your code here
class foodapp:
cantidad_art = 1
def articulosmenu(self, nombre, precio, costototal):
self.nombre = nombre
self.precio = precio
self.costototal = precio * self.cantidad_art
oracion = "Se han agregado:" + str(self.cantidad_art) + " del articulo " + str(self.nombre) + " cuyo valor es de " + str(self.precio) + ", por lo tanto el cliente debe pagar " + str(self.costototal)
return oracion
appfood = foodapp
print("Bienvenido al App Food")
print("Menu \n 1. Hamburguesa \n 2. Pollo Frito")
articuloAComprar = input("Seleccion el articulo que quiere comprar: ")
if articuloAComprar == 1 :
appfood.cantidad_art = eval(input("Ingrese la cantidad de articulos: "))
print(appfood.articulosmenu(appfood,"Hamburguesa", 7800, 0))
elif articuloAComprar == 2 :
appfood.cantidad_art = eval(input("Ingrese la cantidad de articulos: "))
print(appfood.articulosmenu(appfood,"Pollo Frito", 4000, 0))
Can someone please enlighten me on where the error is? All I'm getting is
File "<string>", line 25
elif articuloAComprar == 2 :
^
SyntaxError: invalid syntax
UPDATE:
After fixing some indent issues with your help I've got a new version; however, after entering the articuloAComprar input value the code just goes idle with no errors
class foodapp:
cantidad_art = 1
def articulosmenu(self, nombre, precio, costototal):
self.nombre = nombre
self.precio = precio
self.costototal = precio * self.cantidad_art
oracion = "Se han agregado:" + str(self.cantidad_art) + " del articulo " + str(self.nombre) + " cuyo valor es de " + str(self.precio) + ", por lo tanto el cliente debe pagar " + str(self.costototal)
return oracion
appfood = foodapp
print("Bienvenido al App Food\n")
print("Menu \n 1. Hamburguesa \n 2. Pollo Frito")
articuloAComprar = input("Seleccion el articulo que quiere comprar: ")
if articuloAComprar == 1 :
appfood.cantidad_art = input("Ingrese la cantidad de articulos: ")
print(appfood.articulosmenu(appfood,"Hamburguesa", 7800, 0))
elif articuloAComprar == 2 :
appfood.cantidad_art = input("Ingrese la cantidad de articulos: ")
print(appfood.articulosmenu(appfood,"Pollo Frito", 4000, 0))
articuloAComprar==1, and what do you want the output to be ifarticuloAComprar==2