BASIC PYTHON PROGRAM

 1.

a. Develop a python program to read 2 numbers from the keyboard and perform the basic arithmetic operations based on the choice. (1-Add, 2-Subtract, 3-Multiply, 4-Divide).

b. Develop a program to read the name and year of birth of a person. Display whether the person is a

senior citizen or not.

2.

a. Develop a program to generate Fibonacci sequence of length (N). Read N from the console.

b. Write a python program to create a list and perform the following operations

• Inserting an element

• Removing an element

• Appending an element

• Displaying the length of the list

• Popping an element

• Clearing the list

3.

a. Read N numbers from the console and create a list. Develop a program to print mean, variance and standard deviation with suitable messages.

b. Read a multi-digit number (as chars) from the console. Develop a program to print the frequency of each digit with a suitable message.

4.

Develop a program to print 10 most frequently appearing words in a text file. [Hint: Use a dictionary with distinct words and their frequency of occurrences. Sort the dictionary in the reverse order of frequency and display the dictionary slice of the first 10 items.

5.

Develop a program to read 6 subject marks from the keyboard for a student. Generate a report that displays the marks from the highest to the lowest score attained by the student. [Read the marks into a 1-Dimesional array and sort using the Bubble Sort technique].

6.

Develop a program to sort the contents of a text file and write the sorted contents into a separate text

file. [Hint: Use string methods strip(), len(), list methods sort(), append(), and file methods open(),

readlines(), and write()]


7.

Develop a function named DivExp which takes TWO parameters a, b, and returns a value c (c=a/b). Write a suitable assertion for a>0 in the function DivExp and raise an exception for when b=0. Develop a suitable program that reads two console values and calls the function DivExp.

8.

Define a function that takes TWO objects representing complex numbers and returns a new complex number with the sum of two complex numbers. Define a suitable class ‘Complex’ to represent the complex number. Develop a program to read N (N >=2) complex numbers and to compute the addition of N complex numbers.

9.

Text Analysis Tool: Build a tool that analyses a paragraph: frequency of each word, longest word, number of sentences, etc.

10.

Develop Data Summary Generator: Read a CSV file (like COVID data or weather stats), convert to dictionary form, and allow the user to run summary queries: max, min, average by column.

11.

Develop Student Grade Tracker: Accept multiple students’ names and marks. Store them in a list of tuples or dictionaries. Display summary reports (average, topper, etc.).

12.

Develop a program to display contents of a folder recursively (Directory) having sub-folders and files (name and type).

No comments:

Post a Comment