课程: Programming Concepts for Python
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Parameters and arguments
- The function I use for making an omelet is very convenient, but it's also very boring. Every time I perform that function, I produce the exact same generic omelet. It's tasty, but I like variety. So rather than making the same generic omelet every time, I'll modify my function so I can add a special ingredient to it. Now, when I decide to make an omelet, I'll choose an ingredient, like maybe this plate of bacon, and I'll use that ingredient as the input to my omelet making function. Let's take a quick look at how we can pass input ingredients to the make omelet function in Python. This example script has the mix and cook, make omelet and make pancake functions we defined in the previous video. Let's modify the make omelet function so we can pass inputs to it by adding an input parameter inside of the parentheses named ingredient. This parameter is a variable name that we can use inside of the make omelet function to…