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

Python

The document contains a series of programming tasks in Python, including implementing various operators, handling input/output with lists and tuples, working with binary files, and performing mathematical calculations. It also includes tasks related to string manipulation, such as counting specific characters and filtering lists. Additionally, there are exercises on finding prime numbers, calculating GCD, and removing empty strings from lists.
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)
2 views3 pages

Python

The document contains a series of programming tasks in Python, including implementing various operators, handling input/output with lists and tuples, working with binary files, and performing mathematical calculations. It also includes tasks related to string manipulation, such as counting specific characters and filtering lists. Additionally, there are exercises on finding prime numbers, calculating GCD, and removing empty strings from lists.
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

Q1: Implement python script to show the usage of various operators available in python language.

Q2: Write a program which accepts a sequence of comma-separated numbers from console and generate a list
and a tuple which contains every number. Suppose the following input is supplied to the program: 34, 67, 55,
33, 12, 98. Then, the output should be: ['34', '67', '55', '33', '12', '98'] ('34',67', '55', '33', '12', '98').

Q3: Write a program to enter the following records in a binary file:


Item No integer
Item_Name string
Quantity integer
Price float
Number of records to be entered should be accepted from the user.

Read the file to display the records in the following format:


Item No:
Item Name:
Quantity:
Price per item:
Amount: (to be calculated as Price * Quantity)

Q1: Write a function unique to find all the unique elements of a list.

Q2: Implement a python script for factorial of number by using recursion.

Q3: From the below text perform the following tasks (alphabets are case insensitive):

“The standard Lorem Ipsum passage, used since the 1500. Lorem ipsum dolor sit amet,
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et Dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.”

Tasks
a. Find how many words are starting with a capital letter.
b. Create a dictionary of vowels as keys and count as values from the above passage.

(python 14-2-26)

Q1:Write a program which makes use of function to display all such numbers which are divisible by 7 but are
not a multiple of 5, between 1000 and 2000.

Q2: Find the sum and average of given numbers using lists.

Q3: With a given tuple (1, 2, 3, 4, 5, 6, 7, 8, 9, 10), write a program to print the first half values in one line and
the last half values in one line.

Q1:
Create a Python program to calculate simple interest using user input for
principal and literals/constants for rate and time. Ensure the constants are
well-defined, and the output is clearly formatted.

Q2:

Find the sum of all the primes below a user-defined number.

Q3:
Write a Python program to find the GCD (Greatest Common Divisor) of two
numbers.
[The largest number that divides both input values without leaving a remainder]
If input is: 60 and 48 then output is: 12

Question 1 (Attempted)
From the below text perform the following tasks (alphabets are case
insensitive):
“The standard Lorem Ipsum passage, used since the 1500. Lorem ipsum dolor sit
amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
Dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.”

Tasks
Find the count of alphabets. E.g.
count of ‘a’ is 2
count of ‘b’ is 5
……………
count of ‘z’ is 6 *
Question 2 (Attempted)
Write a Python program to remove empty strings from the list of strings.
If input is: list1 = [“DL”, “”, “TN”, “TL”, “”, “KK”]
then output is: [“DL”, “TN”, “TL”, “KK”]

Question 3 (Attempted)
Write a program to perform the addition of two square matrices.

You might also like