call function with arguments - Introduction to Python: Absolute Beginner Module 2 Video 1

Publié le: 29 juillet 2021
sur la chaîne: Book Simplifiers
147
4

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.')


Sur cette page du site, vous pouvez voir la vidéo en ligne call function with arguments - Introduction to Python: Absolute Beginner Module 2 Video 1 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Book Simplifiers 29 juillet 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 147 fois et il a aimé 4 téléspectateurs. Bon visionnage!