Python Programming Language: Computer Application:
Python Programming Language | Functions in Python | Examples of Functions in Programs | Lecture 10
Review:
In the previous video, we studied about Dictionaries in Python
What is a dictionary?
What are some of the methods that we will be using with dictionaries?
Dictionaries are a collection of objects or elements, in which each element has a key and a value.
The key has to be immutable and the value can be anything.
Dictionary can be used with tuples
In this video we shall see Functions in Python:
If you want to create a certain code or a set of task that you want to use at one point in your program, and later on you would like to perform the same set of operations in your code. i.e. You would like to do it over and over again.
But you do not want to keep typing the same set of commands over and over again.
This is actually what functions are created for. So you can define the functions once or a block of functions in your code and then call that set of commands function so that each time you need it.
Examples of Functions:
Using Distance formula in a program:
Distance between two given points
Distance of a point from the origin
Number of arguments in a function
Usage of Functions in a program to add numbers –
Usage of For Loop
Local Variables and Global Variables
If a variable is defined in a function it is the local variable and if the variable is defined outside the function then it is the global variable.
Video by Edupedia World (www.edupediaworld.com), Free Online Education;
Download our App : https://goo.gl/1b6LBg
Click here https://goo.gl/HjNegN to watch more videos on Python Programming Language- Complete Tutorial;
All Rights Reserved.