From the course: Programming Foundations: Real-World Examples
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Add new input parameters - Python Tutorial
From the course: Programming Foundations: Real-World Examples
Add new input parameters
- The function I use for making an omelette is very convenient, but it's also very boring. Every time I perform that function I produce the exact same generic omelette. It's tasty, but I like variety. So rather than making the same generic omelette every time I'll modify my function so I can add a special ingredient to it. Now, when I decide to make an omelette, I'll choose an ingredient, like maybe this plate of bacon, and I'll use that ingredient as the input to my omelette-making function. Let's take a quick look at how we can pass input ingredients to the make_omelette function in Python. I have the start_01_03_breakfast_functions script open in Idle, which has the mix_and_cook, make_omelette and make_pancake functions that I've already created. I'll modify the make_omelette function now so we can pass input objects directly to it by adding an input parameter inside of the parenthesis called ingredients. This parameter is a variable name that I can use inside of the make_omelette…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.