Concept: Function with Arguments
Calling Functions with Arguments
Functions are used for code tasks that are intended to be reused
Python allows us to create User Defined Functions and provides many Built-in Functions such as print()
print() can be called using arguments (or without) and sends text to standard output, such as the console.
print() uses Parameters to define the variable Arguments that can be passed to the Function.
print() defines multiple string/numbers parameters which means we can send a long list of Arguments to print(), separated by commas.
print() can also be called directly with just its name and empty parenthesis and it will return a blank line to standard output
Example
print('Hello World!', 'I am sending string arguments to print ')
student_age = 17
student_name = "Hiroto Yamaguchi"
print(student_name,'will be in the class for',student_age, 'year old students.')
print("line 1")
print("line 2")
line 3 is an empty return - the default when no arguments
print()
print("line 4")
Task 1
Passing Arguments to print()
Many Arguments can be passed to print
update the print statement to use print() with 8 or more arguments
#[ ] increase the number of arguments used in print() to 8 or more
student_age = 17
student_name = "Hiroto Yamaguchi"
print(student_name,'will be in the class for',student_age, 'year old students.')
En esta página del sitio puede ver el video en línea call function with arguments - Introduction to Python: Absolute Beginner Module 2 Video 1 de Duración hora minuto segunda en buena calidad , que subió el usuario Book Simplifiers 29 julio 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 147 veces y le gustó 4 a los espectadores. Disfruta viendo!