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

Partb - Python Lab

The document contains instructions for 9 Python programming problems. The problems include calculating if a person is a senior citizen, generating a Fibonacci sequence, computing binomial coefficients, analyzing a list of numbers, character frequency in a number, frequent words in a text file, sorting a text file, adding complex numbers, and displaying a student's scorecard.

Uploaded by

manojb.21cse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Partb - Python Lab

The document contains instructions for 9 Python programming problems. The problems include calculating if a person is a senior citizen, generating a Fibonacci sequence, computing binomial coefficients, analyzing a list of numbers, character frequency in a number, frequent words in a text file, sorting a text file, adding complex numbers, and displaying a student's scorecard.

Uploaded by

manojb.21cse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CAMBRIDGE INSTITUTE OF TECHNOLOGY

K.R. PURAM, BENGALURU-560036

Department of Computer Science and Engineering


Python Programming Laboratory

Part-B Programs
1. 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. Develop a program to generate Fibonacci sequence of length (N). Read N from the
console.
3. Write a function to calculate factorial of a number. Develop a program to compute
binomial coefficient (Given N and R).
4. Read N numbers from the console and create a list. Develop a program to print
mean, variance and standard deviation with suitable messages.
5. Read a multi-digit number (as chars) from the console. Develop a program to print
the frequency of each digit with suitable message.
6. Develop a program to print 10 most frequently appearing words in a text file. [Hint:
Use dictionary 16-2-2023 3 with distinct words and their frequency of occurrences.
Sort the dictionary in the reverse order of frequency and display dictionary slice of first
10 items]
7. 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()]. .
8. Define a function which takes TWO objects representing complex numbers and
returns new complex number with a addition 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. Develop a program that uses class Student which prompts the user to enter marks in
three subjects and calculates total marks, percentage and displays the score card
details. [Hint: Use list to store the marks in three subjects and total marks. Use
__init__() method to initialize name, USN and the lists to store marks and total, Use
getMarks() method to read marks into the list, and display() method to display the
score card details.]

You might also like