0% found this document useful (0 votes)
6 views13 pages

PPL Programming

The document outlines ten practical programming exercises in Python, covering topics such as identifiers, data types, arithmetic operations, control flow statements, functions, classes, inheritance, list comprehension, and numeric-to-word conversion. Each practical includes the required software, program syntax, and a brief result statement indicating successful implementation. The exercises are designed to enhance understanding of Python programming concepts using Google Colab.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views13 pages

PPL Programming

The document outlines ten practical programming exercises in Python, covering topics such as identifiers, data types, arithmetic operations, control flow statements, functions, classes, inheritance, list comprehension, and numeric-to-word conversion. Each practical includes the required software, program syntax, and a brief result statement indicating successful implementation. The exercises are designed to enhance understanding of Python programming concepts using Google Colab.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Practical No.

1
Name of the Practical : Write a program to demonstrate Identifiers, Reserve words & constants in
Python.

Software Required :- Python 3.10.4 , Google Colab

Program: A) Importing Keywords:

B) Constant:

c) Identifiers:

Result: In this way, I performed the program to demonstrate identifiers, reserve words & constants
in Python.
Practical No. 2
Name of the Practical : Write a program to Interpret Data Types in Python.

Software Required : Python 3.10.4 , Google Colab

Program: 1) Integer (int)

2) Float (float)

3) String (str)

4) Complex (complex)

5) Boolean (bool)

6) None (None Type)

7) Tuple (tuple)

8) List (list)
9) Range (range)

10) Set(set)

11) Frozen Set (frozenset)

12) Bytes

13) Bytesarray

14) Dictionary

Results: In this way, I write a program to interpret data types in Python.


Practical No. 3
Name of the Practical : WAP to Evaluate Different Arithmetic Operations Using Operators.

Software Required : Python 3.10.4 , Google Colab

Program :

Result : In this way, I write a program to evaluate different Arithmetic Operations using operators.
Practical No. 4
Name of the Practical : WAP to Find Factorial of Given Number using Control Flow Statement.

Software Required : Python 3.10.

Google Colab

Syntax : for iterator_var in sequence:

statements

OR

while expression:

statements

Program :

Result : In this way, I write a program to find factorial of given number using control Flow
Statement.
Practical No. 5
Name of the Practical : WAP to Design Function to Find Max and Min of two, three numbers.

Software Required : Python 3.10.4 , Google Colab

Syntax : def function_name(parameters):

Statements

Program:

Result : In this way, I write a program to design function to find max and min of two, three numbers.
Practical No. 6
Name of the Practical : WAP to Find Power of Given Numbers by Lambda Expression.

Software Required: Python 3.10.4

Google Colab

Syntax : lambda arguments : expression

Program:

Result : In this way, I write a program to find power of given numbers by Lambda Expression.
Practical No. 7
Name of the Practical : WAP to Create Class and Objects for various Arithmetic Operations.

Software Required : Python 3.10.4 , Google Colab

Syntax : class ClassName: #Statements

Program:

Result: In this way, I write a program to create class and objects for various Arithmetic Operations.
Practical No. 8
Name of the Practical : Write a program to Demonstrate Inheritance concept with suitable example
Software Required : Python 3.10.4 , Google Colab

Syntax: class a:

Statements

class b(a):

Statements

Program :

Result: In this way, I write a program to to Demonstrate Inheritance concept with suitable example.
Practical No. 9
Name of the Practical : Write a program to Understand Python List Comprehension with suitable
example.

Software Required : Python 3.10.4 , Google Colab

Syntax : list=[element expression for element i]

Program : #Creating list of even [Link] 1 to 100

Result: In this way, I write a program to Understand Python List Comprehension with suitable
example.
Practical No. 10
Name of the Practical : Write a program to Design Numeric value to Word Converter.
Software Required : Google Collab.
Syntax : ! pip install num2words
Collecting num2words

Downloading [Link] (13 kB) Collecting

docopt>=0.6.2 (from num2words)

Downloading [Link] (25 kB) Preparing

metadata ([Link]) ... done

Downloading [Link] (163 kB)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
━━━ 163.5/163.5 kB 5.6 MB/s eta 0:00:00 Building

wheels for collected packages: docopt Building wheel for

docopt ([Link]) ... done

Created wheel for docopt: filename=[Link] size=13706


sha256=65eeacca65c94c8ac658474735e457382e65d304f9ea4b1f1c3bfe917e292e6e

Stored in directory:
/root/.cache/pip/wheels/1a/bf/a1/4cee4f7678c68c5875ca89eaccf460593539805c3906722228

Successfully built docopt

Installing collected packages: docopt, num2words Successfully

installed docopt-0.6.2 num2words-0.5.14

Program: n = int(input("Enter a number to convert number to word”)

print('US: ', num2words(n))

print('INDIA: ',num2words(n, lang='en_IN')) #Hype v = lambda

x,y : x if x>y else y

print(v(33,55))

p = lambda x,y: x**y print(p(3,2))

class Arith:

def init (self,a,b):

self.a = a self.b = b

def add(self):
Practical No. 10
print(f'add of {self.a} and {self.b} = ',sel def

sub(self):

print(f'substraction of {self.a} and {self.b}) def

prod(self):

print(f'product of {self.a}and {self.b} = ', o1 =

Arith(22,11)

o2 = Arith(33,44) [Link]()

[Link]()

[Link]()

[Link]() x = 22

print(type(x))

z = lambda a,p:a**p print(z(4,3))

def sum(a,b): s = a+b

print(s) sum(3,5)

Output :
Enter a number to convert number to word6 US: six

INDIA: six 55

substraction of 33 and 44 = -11

product of 33 and 44 = 1452

add of 33 and 44 = 77

substraction of 22 and 11 = 11

<class 'int'>

64

Result: Successfully implemented numeric-to-word conversion and object-oriented arithmetic


operations using Python..

You might also like