Simple Functions - Introduction to Python: Absolute Beginner Module 2 Video 2

Veröffentlicht am: 03 August 2021
auf dem Kanal: Book Simplifiers
40
2

Create a simple Function
Creating user defined functions is at the core of computer programming. Functions enable code reuse and make code easier to develop and maintain.
basics of a user defined function
define a function with def
use indentation (4 spaces)
define parameters
optional parameters
return values (or none)
function scope (basics defaults)
def some_function():
use the def statement when creating a function

use a function name that starts with a letter or underscore (usually a lower-case letter)
function names can contain letters, numbers or underscores
parenthesis () follow the function name
a colon : follows the parenthesis
the code for the function is indented under the function definition (use 4 spaces for this course)
def some_function():
#code the function tasks indented here
The end of the function is denoted by returning to no indentation

Example
defines a function named say_hi
def say_hi():
print("Hello there!")
print("goodbye")
define three_three
def three_three():
print(33)


Auf dieser Seite können Sie das Online-Video Simple Functions - Introduction to Python: Absolute Beginner Module 2 Video 2 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Book Simplifiers 03 August 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 40 Mal angesehen und es wurde von 2 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!