0% found this document useful (0 votes)
0 views3 pages

2-July

The document discusses programming languages, categorizing them into procedure-oriented and object-oriented types, with Python being both. It highlights the advantages of procedure-oriented programming, such as easier debugging, less memory usage, and code reusability. Additionally, it provides examples of function definitions and user-defined functions in Python, demonstrating their usage in various programming tasks.

Uploaded by

Sandeep sahu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views3 pages

2-July

The document discusses programming languages, categorizing them into procedure-oriented and object-oriented types, with Python being both. It highlights the advantages of procedure-oriented programming, such as easier debugging, less memory usage, and code reusability. Additionally, it provides examples of function definitions and user-defined functions in Python, demonstrating their usage in various programming tasks.

Uploaded by

Sandeep sahu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

# Dictionary programs are pending

# Function

'''
types of Programmimg languages
1) procedure oriented ( C )
2) Object Oriented ( C++ , Java )
Note : Python is Both procedure + object oriented Prog. Lang

1) Procedure Oriented Prog. lang. :

Drawback of Non Procedural Prg. Lang.


1. Debugging is very tough ( remove run time errors )
2. Taking huge amount of memory
3. Repeatation Of Code
4. Time Cosuming ( Huge amount of time for its implementation )

EMp Sal mgt S/W


int main()
{
lot of variables ( huge memory )
-------
-------
-------
-------
4000 lines
-------
-------
-------
-------
}

# Procedure oriented approach S/W


Advantages of Procedure oriented S/W
1. Debugging is easy
2. less amount of memory ( In Procedure oriented approach , at a time compiler
allocate
memory of only calling function , not for all functions )
3. reusuability of code ( Throgh no of times function calling )
4. its save implementation time

void salary()
{
Variables Declaration
----
----
}
void marks_sheet()
{
----
----
}
void Bonus()
{
Variables Declaration
----
----
----
}

void Grade()
{
Variables Declaration
----
----
----
}

int main()
{
Variables Declaration
---------
---------
---------
---------
---------
}

Function Definition : it's a Named block , containing some statements


and used to perform a particular task

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()

#no = int(input("Enter Any no ")) # 4 or 67 or 123


table(4) #calling
table(12) #calling
table(10) #calling
'''

You might also like