XfaceApp

XfaceApp

Ingia kwenye blog hii kujua jinsi Xface app inavyofanya kazi www.myteknohood.blogspot.com

Python#22: User defined functions with python 04/07/2020

Link xface on YouTube now

https://youtu.be/44Vm39hDyQI

Python: user defined functions

In all programming and scripting language, a function is a block of program statements which can be used repetitively in a program. It saves the time of a developer. In Python concept of function is same as in other languages. There are some built-in functions which are part of Python. Besides that, we can defines functions according to our need.
User defined function
In Python, a user-defined function's declaration begins with the keyword def and followed by the function name.
The function may take arguments(s) as input within the opening and closing parentheses, just after the function name followed by a colon.
After defining the function name and arguments(s) a block of program statement(s) start at the next line and these statement(s) must be indented.


Here is the syntax of a user defined function.
Syntax:
def function_name(argument1, argument2, ...) :
statement_1
statement_2
....
Inside Function Call
()
# f(0, 0)
()
# f(x=0, y=0)
(, )
# f(0, y=0)

Inside Function Call
def f():
# def f(x, y):
def f():
# def f(x=0, y=0):
def f(, ):
# def f(x, y=0):
Call a function
Calling a function in Python is similar to other programming languages, using the function name, parenthesis (opening and closing) and parameter(s). See the syntax, followed by an example.
Syntax:

function_name(arg1, arg2)


Argument combinations:
def f(a, b, c): # f(a=1, b=2, c=3) | f(1, b=2, c=3) | f(1, 2, b=3) | f(1, 2, 3)
def f(*, a, b, c): # f(a=1, b=2, c=3)
def f(a, *, b, c): # f(a=1, b=2, c=3) | f(1, b=2, c=3)
def f(a, b, *, c): # f(a=1, b=2, c=3) | f(1, b=2, c=3) | f(1, 2, c=3)

def f(*args): # f(1, 2, 3)
def f(a, *args): # f(1, 2, 3)
def f(*args, c

Python#22: User defined functions with python

17/03/2020

Xface need 19 python programmers with at least diploma certification

Telephone