Lesson - 25 : Python3 - Python Function : Argument with default values

Опубликовано: 20 Декабрь 2017
на канале: Sada Learning Hub
50
2

**************************************************
Python Core PlayList :    • Lesson - 01 : Python3 - What is python  
Python Advanced PlayList :    • Lesson - 46 : Python Advanced - Python OOP...  
**************************************************
Python Function : Argument with default values:
Functions are the re-usable pieces of code which helps us to organize structure of the code. We create functions so that we can run a set of statements multiple times during in the program without repeating ourselves.

To specify default values of argument, you just need to assign a value using assignment operator.

Example :
def func(i, j = 100):
    print(i, j)

Above function has two parameter i  and j . j  has default value of 100 , means we can omit value of j while calling the function.

func(2) # here no value is passed to j, so default value will be used

func(2, 300) # here 300 is passed as a value of j, so default value will not be used

Sample Projects : https://github.com/SadaLearningHub1/P...


На этой странице сайта вы можете посмотреть видео онлайн Lesson - 25 : Python3 - Python Function : Argument with default values длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Sada Learning Hub 20 Декабрь 2017, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 50 раз и оно понравилось 2 зрителям. Приятного просмотра!