RUVIDEO
Поделитесь видео 🙏

Functions in Python Part 2 смотреть онлайн

📁 Лайфстайл 👁️ 16 📅 03.12.2023

FUNCTIONS - User-defined Functions
-----------------------------------------------------------------
2 sections:
Function Definition
Function Calling

Syntax:
def Function_Name(parameters):
'''Documentation String'''
Statements to be executed
return

Example:
# Function Definition
def Addition():
a = int(input("Enter the Number: "))
b = int(input("Enter the Number: "))
c = int(input("Enter the Number: "))
sum = a+b+c
print(a,"+",b,"+",c,"=",sum)

print("Welcome to Functions")
print("Here we are going to add 3 Number")
# Function Calling
Addition()
print("Program Ends")

Variables created within a Function -- Local Variables
The scope of the local variables resides only within the suite in which we are creating it.
When tried to access outside of the scope, ERROR is generated.

Parameters -
---------------------
Variables of my Functions.
It is used to pass some information (values) to the Function from the Main program.
'N' Parameters can be provided for a Function.

Example:
# Function Definition
def Addition(x,y,z):
sum = x+y+z
print(x,"+",y,"+",z,"=",sum)

print("Welcome to Functions")
print("Here we are going to add 3 Number")
a = int(input())
b = int(input())
c = int(input())
# Function Calling
Addition(a,b,c)
print("Program Ends")

Example:
# Function Definition
def Message(x):
print("Hello",x,"How are you doing?")

print("Welcome to Functions")
s = input("Enter your Name: ")

# Function Calling
Message(s)

print("Program Ends")
-----------------------------------------------------------------------------------------------------------------------
How many Parameters you are creation in Function Definition, that much of values needs to be passed in Function Calling
# Function Definition
def Message(x):
print("Hello",x,"How are you doing?")

print("Welcome to Functions")
s = input()
print(s)
# Function Calling
Message()

print("Program Ends")
-----------------------------------------------------------------------------------------------------------------------
The variables that is created, need not be bounded with any data type.

Input:
10
20
30
Output:
10 + 20 + 30 = 60

Input:
10.25
20.85
30.45
Output:
10.25 + 20.85 + 30.45 = 61.55

Input:
'New'
'Python'
'Version'
Output:
New + Python + Version = NewPythonVersion

# Function Definition
def Addition(x,y,z):
sum = x+y+z
print(x,"+",y,"+",z,"=",sum)

print("Welcome to Functions")

a = eval(input())
b = eval(input())
c = eval(input())

# Function Calling
Addition(a,b,c)

print("Program Ends")
-----------------------------------------------------------------------------------------------------------------------
Reusability - Create Once and Call the Function N time
# Function Definition
def Addition(x,y,z):
sum = x+y+z
print(x,"+",y,"+",z,"=",sum)

print("Welcome to Functions")

# Function Calling - N times
Addition(10,20,30)
Addition(10.50,20.25,30.10)
Addition('Python ','Version ','3.9')
Addition(10+2j,20+5j,30+9j)
Addition(True,False,True)

print("Program Ends")

Output:
Welcome to Functions
10 + 20 + 30 = 60
10.5 + 20.25 + 30.1 = 60.85
Python + Version + 3.9 = Python Version 3.9
(10+2j) + (20+5j) + (30+9j) = (60+16j)
True + False + True = 2
Program Ends
-----------------------------------------------------------------------------------------------------------------------
Keyword: return
It is used to pass some information(value) from the Function to the main program.
return -- act as delivery person
Where in the main program the value will be given?
It will be always returned to the place from where we are calling the function from.

# Function Definition
def Addition(x,y,z):
sum = x+y+z
return sum

print("Welcome to Functions")

# Function Calling -
r = Addition(10,20,30)
print("Result = ",r)

print("Program Ends")

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Functions in Python Part 2» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.