0% found this document useful (0 votes)
3 views

Python Index

Aaa

Uploaded by

wasidov282
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)
3 views

Python Index

Aaa

Uploaded by

wasidov282
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
You are on page 1/ 4

Python Practical Index

Sr Marks
Aim Date Sign
No /10
Practical Set–1
1 Write a Python program to print “HelloWorld”.
2 Write a Python program to swap two variables using third variable.
3 Write a Python program to swap two variables without third variable.
4 Write a Python program to find square root of positive number.
5 Write a Python program to find area of a rectangle and circle.
6 Write a Python program to find sum of n natural numbers without loop.
7 Check various arithmetic operators of Python.
8 Write a Python program to check output of modulo operator.
Practical Set–2

1 WAP to check whether entered number Is even or odd.


2 WAP to find whether entered number is positive,negative or zero.
3 WAP to find roots of quadratic equations if roots are real.
4 WAP to check whether entered character is vowel or consonant.
5 WAP to find maximum of three numbers(nested if-else).
WAP to calculate the salary of an employee based on following conditions
(nested if-else):
6 1. If degree=B.E.and experience<5years,salary=30000
2. If degree=B.E.and experience>=5years,salary=40000
3. If degree=M.E.and experience<5years,salary=50000
4. If degree=M.E.and experience>=5years,salary=60000
WAP to check whether entered input is character,digit or special symbol
7
Using ladder if-else.
Practical Set–3

1 WAP to find sum of N scanned numbers.


2 Write a Python program to print Fibonacci series up to n terms.
3 WAP to find the reverse of given numbers (Example2564-4652).
4 WAP to check whether entered number is prime or not.
WAP to print all eve numbers between 1 to n except the numbers
5
Divisible by 6.
Write a python program to check whether given number is Armstrong or
6
not.
Write a python program to check whether given number is Palindrome or
7
not.
WAP to print the following:
1) 2)
1 *****
8 12 ****
123 ***
1234 **
12345 *
Practical Set–4
Write a python program which covers all the methods(functions) of list.
1

2 Write a Python program to append a list to the second list.


Write a python program to check whether the given list is palindrome or
3
not.
4 Write a python program to store strings in list and then print them.
Write a python program to print list of prime numbers upto N using loop
5
And else clause.
6 Write a Python program to multiply all the items in a list.

7 Write a Python program to get the largest number from a list.

8 Write a Python program to find the second smallest number in a list.


Write a Python program to count the number of strings where the string length is
9 2 or more and the first and last character are same from a given list of strings.

10 Write a Python program to remove duplicates from a list.


Write a Python program to find the list of words that are longer than n from a
11
given string.
Write a Python function that takes two lists and returns True if they have at least
12
one common member.
Write a Python program to print the numbers of a specified list after removing
13
even numbers from it.
14 Write a Python program to add two matrices.
15 Write a Python program to transpose a given matrix.
Flatten a nested list structure. Example: if list1 = [1, [2, 3], [4, 5, [6, 7] ] ] then try
16 to convert it in 1-dimensional [1, 2, 3, 4, 5, 6, 7]

17 Write a Python program to split a list every Nth element.


Practical Set–5
Create a set of integers as follows:
 initialize the set directly
 initialize empty set and then add values
 from a list
 from another set
1
 using range
 print the elements of set iteratively
 check the functionality of remove and discard
Create two sets of integers and find their difference, intersection, union and
2 symmetric difference. Also find subset and superset from these two. Apply
methods as well as operators for all operations.
Write a function called find_dups that takes a list of integers as its input
3 argument and returns a set of those integers that occur two or more times in the
list.

The following company details are given for analysis: customer acc no, customer
name, purchased product no, product category, unit price. Marketing is interested
in understanding customer purchase patterns. Find the answers of following
questions:
 How many customers have purchased bread?
4  How many customers have purchased butter?
 How many customers have purchased bread and butter?
 Who has purchased bread but not butter?
 Which customers have purchased bread, butter and milk?
 Print the name of the most valuable customers who have
purchased all three items.

Write a program to create an empty tuple, tupple with single value, tuple with
5
multiple values/collections and a tuple with different data types.
6 Check all the methods of tuple.

7 Write a program to find multiple items of a tuple.


8 Write a Python script to add a key to a dictionary.

9 Write a Python script to print a dictionary where the keys are numbers between 1
and 15 (both included) and the values are square of keys.
10 Write a Python script to check if a given key already exists in a dictionary.

11 Write a Python script to merge two Python dictionaries..

12 Write a Python program to remove a key from a dictionary

13 Write a Python program to create a dictionary from two lists..


Write a Python program to check if all dictionaries in a list are empty or not.
14
Practical Set–6
1 Write a program to find the prime numbers in a specific range using filter.

2 Write a python program to make sum of particular range using reduce. .


3 Write a python program to find maximum from a list using reduce. .
Write a python program to find Armstrong number in a specific range using map.
4
Write a python program to apply two functions (square and cube) simultaneously
5
on a specific range using map..
Write python programs using (i) map/filter and function (ii) map/filter and lambda
(iii) list comprehension
 Create a list to store the cube of all the elements in a given list.
 Create a list of equivalent Celsius degree from Fahrenheit.
6
 Create a list that stores only positive numbers from givenlist.
 Create a list that stores only alphabets from given list.

Practical Set–7
write a python program to read the text file using read (), readlines() and
1
readline() methods.
Write a python program to read a file containing pairs of numbers in a file. Create
2 a file that contains the pairs of numbers as well as addition and multiplication of
the two numbers in the same line.
Write a python program to create a function that returns smallest value from the
3
given text file.
Practical Set-8
Write a Python program which will throw exception if the value entered by user
1 is less than zero.

Write a python program to demonstrate use of finally and else keywords


2

Practical Set-9
Write a Python program to create class KSV with attributes like class variable cnt,
1
instance variables x and y, instance methods get_value and print_value
Write a python program to demonstrate overloading of add (+) operator
2

Practical Set-10
Write a Python program to search a specific value from a given list of values using
1
binary search method
Write a python program to sort the elements of list values using selection sort.
2

You might also like