PYTHON - EXTRA ASSIGNMENT PROGRAMS





Control Structure

Check if a given number is divisible by 5

Sum of N different numbers

Sum and average of N different numbers

Sum of numbers between 1 and 50 which are divisible by 3 and not by 5

First N even numbers

First N numbers divisible by 4


Functions

Area and circumference of a circle

Simple and Compound Interest

Smallest and largest digit in a number

Sum of digits of a number until single number is obtained

Sum of even and odd digits of a number

Sum of squares of individual digits of a number

Sum of cubes of individual digits of a number

Digits in odd position of a number

Digits in even position of a number

Factorial of first N numbers

Read a name and display a welcome message

Menu driven Calculator program


Lists

Create a list and perform the following operations on the list

Display content of list

Display length of list

Display element in given position in the list

Add elements to the list

Remove elements from the list:

Slice

Sort

Reverse

Replace elements

Join two lists

Membership test

Nested lists


Lists and Functions

Smallest number from a set of numbers

Largest number from a set of numbers

Sum of even and odd numbers from a set of numbers

Sort the elements of a matrix

Read an N x N matrix. Check if the last element of each row is the sum of the all other elements in that row


String

Two words form a metathesis pair, if you can transform one into the other by swapping two letters. Example – conserve and converse. Write a program to find all the metathesis pair in a dictionary.

Read a word and check if all the letters are in alphabetical order

Two words are anagrams if you can rearrange the letters from one to spell the other. Write a program that displays all lists of anagrams from the word list. Example:
[‘silent’, ‘listen’]
[‘deltas’,’desalt’,’lasted’,’salted’,’slated’,’staled’]

Two words are reverse pair, if each is the reverse of the other. Example: was and saw. Write a program that finds all the reverse pairs in the word list.

Two words “interlock” if taking alternate letters from each forms a new word. Example, “shoe” and “cold” interlock to form “schooled”. Write a program that finds all pairs of words that interlock.

Dictionary

Creating a Dictionary and perform the following operations:

Get the values in a Dictionary

Looping over dictionary

Add elements to a dictionary

combine two dictionaries

Delete elements of a dictionary

Test the presence of a key

Write a program to generate a dictionary containing the list of customers and their telephone numbers. Write functions to find the telephone number of a given customer and to find the customer details if the telephone number is specified.

Files

Read a file and display all words containing all 5 vowels atleast once. Example – automobile

Write a program called cross reference that creates a dictionary of all words in a document, and for each word, a list of the line numbers on which it occurs. Remove noise words like “the”, “and”, and so on.

Write a program to compare two files, printing the first line where they differ.

Write a program that displays the three most frequently occurring words in a file.

Write a program that displays five most frequently occurring characters in a file.

Given a file containing customer names and their phone numbers, write a program to find the telephone number of a given customer.

Write a program to read student details (Name, roll number and CGPA) and write to file. Also display the file content.





No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu