2-July
2-July
# Function
'''
types of Programmimg languages
1) procedure oriented ( C )
2) Object Oriented ( C++ , Java )
Note : Python is Both procedure + object oriented Prog. Lang
void salary()
{
Variables Declaration
----
----
}
void marks_sheet()
{
----
----
}
void Bonus()
{
Variables Declaration
----
----
----
}
void Grade()
{
Variables Declaration
----
----
----
}
int main()
{
Variables Declaration
---------
---------
---------
---------
---------
}
void strlen_copy()
{
performing calculating length of str and copyig str
// not good approach
}
void strlen()
{
}
void strcopy()
{
}
TYPES OF FUNCTIONS
1) Library defined function ( In-Built Fns )
those are already defined in compiler
Ex print(),input(), id(), type() , len() , eval() , etc
2) User Defined Functions :
those are defined as per requirements
Syntax :
def function_name(arguments):
--------------
--------------
--------------
return ( Optional )
'''
'''
# WAP to print any greeting msg using function
def msg(person): # 'person' is a parameter
print("Hello ",person)
msg("Papa") # Calling
msg("Friends") # Calling
msg("Mammy") # Calling
msg("Brother") # Calling
# msg() # Error
# msg("Papa","Mammy") # Error
'''
'''
# WAP to calculate two values using fn
def Add(x,y):
#print(type(x),type(y))
print(" SUM = " , x+y )
Add(10,20)
Add(10.89,20.78)
Add(10,200.34)
Add(10.122,20)
Add("Hello ","Friends")
Add([1,23.44],[34.56,'Bhopal',34.89])
'''
'''
# WAP to print Table of any no using function
def table(n):
for i in range(1,11):
print(n*i,end=' ')
print()