- 2

Please explain the code and its output

class Pizza: def__init__(self,toppings): self.toppings=toppings @staticmethod def validate_topping( topping): if topping=="pineapple": raise ValueError("No pineapple") else: return True ingredients=["cheese","onions","spam"] if all( Pizza.validate_topping(i) for I in range ingredients): pizza=Pizza(ingredients)

1st Mar 2017, 5:16 PM
Pragya Priya
Pragya Priya - avatar
1 Antwort
+ 3
Please don't ask generic question... If you have a problem, describe it accuratly as possible, telling what point you don't understand ^^
2nd Mar 2017, 8:49 AM
visph
visph - avatar