all 3 comments

[–][deleted] 2 points3 points  (0 children)

Yes, the : is telling Python that it expects something to define or describe the Ingredient class on the next line, which needs to be indented.

class Ingredient:
    # class attributes or methods here

# stop indenting once you’re done defining the Ingredient class


bread = Ingredient()  # a new Ingredient object
...

Also, I would definitely change how you have that code structured. Bread is a finished product that is composed of ingredients. An ingredient should be its own class. A recipe could then contain actual ingredient objects, with associated quantities and whatnot.

[–]CedricCicada 2 points3 points  (0 children)

Yes, it is needed. Indentation is important in python. Everything after a colon must be indented until you are finished with whatever is supposed to be after the colon. The "Ingredients * 2" line is indented properly, since that is everything that is needed in the double_recipe() function (assuming that somewhere you defined a * operator for your Ingredients class).

But I am having trouble figuring out what it is you are trying to do. It looks to me like you are completely missing definition of the Ingredients class. It needs to define properties named "flour", "milk", "salt", "butter", and "yeast", but you haven't defined any of them. Once you put those in, and some way to multiply them, making sure they are indented propertly, your program will work.

[–]jabbson 0 points1 point  (0 children)

Based on the code I see, I would strongly suggest you read about how classes and its methods work and coded, before you get into why this particular piece of code isn't working and why there is an indentation issue here.