Function Call: Parameters
To be really effective you have to know how to use multiple parameters.
˙⋆˖⁺‧₊☽◯☾₊‧⁺˖⋆˙
In Python, functions can take multiple parameters. When calling a function, you can pass multiple values, separated by commas «,». Let's see how this works with the print( ) function.
#Function with multiple parameters
print("You're a wizard", "Harry")
In these examples, the print( ) function is called with multiple parameters. Each parameter is separated by a comma «,», and the print( ) function outputs all the parameters in a single line, separated by spaces.
Combining Different Types
You can also combine different types of parameters, such as strings and numbers, in a single print( ) function call.
#Combining different types
print("Pick number", 3, "m'lord!")
print("Pi is approximately", 3.14)
In these examples, the print( ) function outputs both strings and numbers. Python automatically converts the numbers to strings and separates each parameter with a space.
Practical Application
As you enter the Great Hall, the Head Mage awaits to greet you. Customize your greeting by invoking a spell with a parameter.
⋆˖⁺‧₊ Use the print( ) function with parameters to greet the Ignis Mastery faculty. ₊‧⁺˖⋆
Sample Output:
Welcome to Ignis Mastery!
Invoke this spell to formally greet the faculty.