CHAPTER 2 Flashcards

IN THIS WE WILL LEARN ABOUT FUNCTIONS, SCOPING AND ABSTRACTION.

1
Q

Define functions.

A

it is a block of code that is intended to perform related or single operations. it also provides reusability of code and better modularity in application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

call by reference

A

the original parameter may get updated in case any changes to this parameter are done inside the function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

function declaration

A
def fun_name([arguments]):
"optional documentation string"
statements
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

calling a function

A

calling

it is the same as it is in other languages. it is done by the name of the function along with parameters.

ex: 
def multi(x,y):
    z=x*y
    print("multiplication is ", z)
return

multi(1512)
multi(2
10)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

scope of variables

A

it identifies the part of the program where the particular variable can be accessed.
following are the scope of variable in python:
1. global variables
2. local variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Recursive Functions

A

a function can make a call to another function.

when a function calls itself it is known as a recursive function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Modules

A
it is a file which contains python definition and statements.
the module name is the same as the file name without the suffix .py appended.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly