Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
14 views

Python Programming Lab Index

The document outlines a series of programming exercises for students at Shri Vishnu Engineering College for Women, covering various topics such as arithmetic operations, temperature conversion, financial calculations, string and list manipulations, and more. Each exercise includes specific tasks to be completed, often with conditions or criteria for outputs. The exercises aim to enhance programming skills and understanding of fundamental concepts in Python.

Uploaded by

23b01a1253
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Python Programming Lab Index

The document outlines a series of programming exercises for students at Shri Vishnu Engineering College for Women, covering various topics such as arithmetic operations, temperature conversion, financial calculations, string and list manipulations, and more. Each exercise includes specific tasks to be completed, often with conditions or criteria for outputs. The exercises aim to enhance programming skills and understanding of fundamental concepts in Python.

Uploaded by

23b01a1253
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

SHRI VISHNU ENGINEERING COLLEGE FOR WOMEN

AUTONOMOUS
Vishnupur, BHIMAVARAM – 534202
INDEX

Prog. Page
Date Name of the Program Marks
No. No.

Arithmetic operators usage


1 Find the sum, difference, product, division, remainder, floor division
and exponent of two integers num1 and num2

Convert Fahrenheit to Celsius


2 Convert the temperature given in degrees Fahrenheit to degrees
Celsius

Amount in wallet
3 Find the total amount of money in the wallet, given the number of
currency notes of denomination Rs 500, Rs 200, R 100, Rs 50, Rs20

Bill value
Calculate the bill value based on the number of units of an item sold,
the cost of each item, discount percentage applicable and tax
4 percentage. Number of units, cost of each unit and tax percentage
should be given as input. Discount percentage applicable is
calculated using the following criteria - if the number of units is
greater than 10 discount is 15% else discount is 10%

Grade in subject
Calculate the grade awarded to a student in a subject based on the
marks scored. The grade is awarded based on the following criteria.
5
Marks:>=90 - Grade:A+, Marks:>=80 - Grade:A, Marks:>=70 -
Grade:B, Marks:>=60 - Grade:C, Marks:>=50 - Grade:D, Marks:>=40 -
Grade:E, Marks:<40 - Grade:F

Sum and Average of first n numbers


6 Using while loop, find the sum and average of first N natural
numbers.

Count #positives, #negative, #zeroes


Print the number of positive integers, number of negative integers
7
and number of zeroes enteres by the user.read integers until -1 is
entered. Do not count -1 as a negative number

Integer to Binary
8
Convert an integer number to its binary equivalent
Prog. Page
Date Name of the Program Marks
No. No.

Reverse of a positive integer


9
Find the reverse of a number

List of primes in a range


10
Generate the list of prime numbers in a given range

Check for Armstrong Number


Check if a given number is Armstrong number or not. A positive
11 integer of n digits is called an Armstrong number of order n (order is
number of digits) if abcd… = pow(a,n) + pow(b,n) + pow(c,n) +
pow(d,n) + ….

Factorial using recursive function


12
Find the factorial of a number(Use recursive function)

Sum of the series


13 Find the sum of the series 1 + x + x**2 + ... + x**(n-1)
x and n are given as input by the user

Sum of the series


14 Find the sum of the series 1/2 + 3/4 + 5/6 + ... + 99/100. Print upto
four decimal places

Sum of multiples
15
Print the sum of the first 10 multiples of a given number

Check for perfect number


16
Check if the given number is perfect or not

GCD using recursive function


17
Find the GCD of 2 given numbers. (Use recursive function)

String operations
Perform the following string operations: first letter as the capital
18 letter, all the letters in upper case, all the letters in lower case, first
letter in each word capitalized, change the case of each letter, length
of the string, list of words

List Operations
Print all the elements, Replace the 6th element in the list with the
element 'New'. Add an element 200 at the end of the list, Remove
19 the element at index 5, Delete the elements from index 3 to index 7,
number of elements remaining, Check if the element 10 is present in
the list, maximum element and minimum element in the list, sum of
all the elements in the list, Convert the list to a tuple

Prog. Page
Date Name of the Program Marks
No. No.
Set Operations
Create a set, Print the elements, Add an element 2 using the add()
20 method, Add the elements 2,3,4 using the update() method, Add the
list [4,5] and the set {1,6,8}, Delete the element 4 using the discard
method, Delete the element 6 using the remove method

Set Operations - Union, Intersection, Difference, Symmetric


Difference
21
Create set A and set B, Print the elements, union, intersection,
Difference and symmetric difference of the sets A and B

Dictionary operations
Create a dictionary and print all the elements, Print the number of
22
key, value pairs, Print all the keys, Print all the values, Print the keys
in a sorted order, Delete the element with key 3

Count the number of times each word is repeated


23 Count the number of times each word is repeated in the given test.
Ignore the symbols , . " ! ( )

Perfect, Deficient and Abundant numbers


Given large n, find the sum of all perfect numbers, sum of all
24 deficient numbers and sum of abundant numbers separately. Print
all perfect numbers along with its sum, deficient numbers along with
its sum and abundant numbers along with its sum

Remove duplicate characters in a string


Write a function “remove_duplicates” which takes a string argument
25 and returns a string which is the same as the argument except only
the first occurrence of each letter is present. Make your function
case sensitive.

Number of vowels in the given string


26 Count the number of vowels in the given string. The characters 'a',
'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U' are considered as vowels

Check for Balanced parenthesis


Check if the parentheses in the given expression are balanced or not.
27
If the parenthesis are balanced the program should print 'Balanced'
otherwise 'Unbalanced'

Multiply lists of same length


Write a function mult_lists(a, b) that takes two lists of numbers of
28
the same length, and returns the sum of the products of the
corresponding elements of each. Print the sum as output

Prog. Page
Date Name of the Program Marks
No. No.
Flatten List
Write a function called flatten_list that takes as input a list which
29
may be nested, and returns a non-nested list with all the elements of
the input list

Discriminant of a quadratic equation


30 Write a program that prompts the user to enter values for a, b, c and
displays the result based on discriminant

Exception handling in python


Write a program to divide two integers using exception handling
31
mechanism. Raise an exception when the denominator is 0 or when
a user enters a value which cannot be converted to integer.

Sum and product of NumPy arrays


 Create a numpy array using arange function and 10 as the
argument. Reshape the array to (2,5) and print the array
32  Create a numpy array using arange function and 20,30 as the
arguments. Reshape the array to (2,5) and print the array
 Print the sum of the two arrays
 Print the product of the two arrays

Counting the occurrence of each letter


 Generates 100 lowercase letters randomly and assigns them to
a list of characters, named chars.
33
 Create a list named counts that has 26 int values, each of
which counts the occurrences of a letter in chars
 Print the number of times each character is repeated

Create a module “Prime” to include the following functions.


isPrime(number), alindromePrime(number), isEmirp(number),
mersennePrime(p), printTwinPrimes(range)
Write a test program to import the Prime module and perform the
34 following operations using the functions of Prime module.
 Prints first 100 prime numbers.
 Prints first 10 Palindrome prime numbers.
 Prints first 10 Emirp numbers.
 Prints all Mersenne prime numbers for the p value below 32.
 Prints all twin prime numbers below 1000.

Matrix Multiplication using numpy.matlib


Create a 2D array of shape (3,2) and convert it to a matrix
35
Create a 2D array of shape (2,3) and convert it to a matrix
Find the product of the two matrices and print the result

Total Avg. Marks (Max Marks: 15)

You might also like