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

01 - Python Progamming

This document outlines 16 Python programming midterm exam problems involving calculating simple and compound interest, determining student grades, finding prime and Fibonacci numbers, checking for Armstrong and perfect numbers, palindrome checking, series summation, text file processing to count characters and words, binary file creation and search/update, text file line filtering, random number generation, CSV file creation and search, and stack implementation using lists. The coding and output sections for each problem are blank, suggesting the problems are to be coded as part of the exam.

Uploaded by

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

01 - Python Progamming

This document outlines 16 Python programming midterm exam problems involving calculating simple and compound interest, determining student grades, finding prime and Fibonacci numbers, checking for Armstrong and perfect numbers, palindrome checking, series summation, text file processing to count characters and words, binary file creation and search/update, text file line filtering, random number generation, CSV file creation and search, and stack implementation using lists. The coding and output sections for each problem are blank, suggesting the problems are to be coded as part of the exam.

Uploaded by

Lala Lala
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

PYTHON PROGRAMMING (MID TERM) 2021-2022

Program: 01.WAP for calculating simple and compound interest.

Coding:

Output:
Program: 02.WAP to accept percentage of a student and display grade.

Coding:

Output:
Program: 03.WAP to display prime numbers up to less than certain limit.

Coding:

Output:
Program: 04.WAP to print Fibonacci Series up to certain Limit.

Coding:

Output:
Program: 05.WAP to accept any 3-digit number and find out whether it is an
Armstrong number or not.

Coding:

Output:
Program: 06.Program to determine whether a number is a perfect number.
Coding:

Output:
Program: 07.Program to determine whether a number is a palindrome number.

Coding:

Output:
Program: 08.Write a program to input the value of x and n and print the sum of the following
series: 1 + x+ x2 + x3 + x4 + ------------ xn

Coding:

Output:
Program: 09.Read a text file line by line and display each word separated by a #.

Coding:

Text.txt:

Output:
Program: 10.Read a text and display the number of vowels/ consonants/
uppercase/ lowercase characters in the file.

Coding:

Text.txt:

Output:
Program: 11.Create a binary file with name and roll number. Search for a given
roll number and display the name, if not found display appropriate message.
Coding: First Part

Output:
Coding: Second Part

Output:
Program: 12.Create a binary file with roll number, name and marks. Input a roll
number and update the marks.
Coding: First Part

Output:
Coding: Second Part

Output:
Coding: Third Part

Output:
Program: 13.Remove all the lines that contain the character 'a' in a file and write
it to another file.
Coding:

first.txt (Before Execution):

Output:
first.txt (After Execution):

second.txt (After Execution):


Program: 14.Write a random number generator that generates random numbers
between 1 and 6 (simulates a dice).
Coding:

Output:
Program: 15. Create a CSV file by entering user-id and password, read and search
the password for given user-id.
Coding:
Output:

Details.csv (After Execution):


Program: 16.Write a Python program to implement a stack using a list data-
structure.

Coding:

Output:

You might also like