Beginner level Problems in python
Module 1: Strings and Arithmetic operations
1) WAP to perform following operations
i) concatenate 2 strings
ii) count the number of letter 'L' in the string
iii) calculate length of string
2) WAP to count the number of characters in string
3)WAP to accept a string from user and perform following operations
i) print the first 4 characters of string
ii) add 'ing' at the end of the string and if 'ing' is already present then add 'ly' at the end
iii) remove the character from 4th index
4) WAP to count occurrences of each word in given string
5)WAP to perform following arithmetic operations
i) addition and substraction
ii) square and cube of the number
iii) exponent of the number
6) WAP to perform following arithmetic operations
i) multiplication and division
ii) modulus of 2 numbers
iii) floor division of 2 numbers
7) WAP to perform following operations on list
i) sum all the items in a number list
ii) get the largest number from the same list
iii) copy a list
8)WAP to perform following operations on list
i) multiply all the items in a number list
ii) get the smallest number from the same list
iii) remove 4th and 6th element of list and print it again
9) WAP to create and perform these operations
i) add eleent in tuple
ii) check whether the element in tuple exists
10) WAP to count the number of string where the length is 2 or more and the first and the last elements are same in the list, also print true if two list have at least one value on common
11)WAP to create a tuple of different data types and peform
i) print 4th element of tuple and delete it
ii) print the length of tuple
12) WAP to create a tuple and perform operations
i) print the tuple with the slice of 3:7
ii) reverse a tuple
iii) replace 2 values in tuple and append 2 values in tuple
13) WAP to sort a dictionary by value in ascending and descending order and add a key to dictionary also find maximum and minimum value
14) WAP to take 3 dictionary and print the dictionary also add a new element to this list dictionary and check whether the key already exists.
15) WAP to find the sum and multiplication of all the VALUES in dictionary and remove a key from dictionary
Module 2: Functions, loops, decision making logic
1. Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence after sorting them alphabetically.
2. Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalized.
3. Write a program, which will find all such numbers between 1000 and 3000 (both included) such that each digit of the number is an even number.
4.Find all the primes between 5 to 500. And Write a Python function that takes a number as a parameter and check the number is prime or not?
5.Find all the numbers between 100 to 1000 such that all the digits are same. (E.g. 111,222,333).
6. Write a function to Generate Fibonacci series recursively.
7. Write a Python function to sum all the numbers in a list and functions to find greatest and lowest int in the list.
8. Implement linear search and write another program to reverse a given string.
9. Write a Python function that takes a list and returns a new list with unique elements of the first list.
10. Write a program to implement deposit, withdraw, summary bank operations using decision making logic.
11. Write python functions to rotate the array or list of elements. A) LeftRotation B) RightRotation .
12. Generate following patterns
1. ******** 2. *
**** * *
** * * *
* * * * *
13. Write a program to find the no. of days in a given month of any year. Consider leap year also.
[input: 2018
Month: 02
Output: 28 days]
14. Write a function to check where the number is Armstrong no. or not?
15. Write a menu driven program to calculate the Area and perimeter of Triangle, Circle, rectangle.
Module 3: Object Oriented Programming Classes, Methods, objects
1.write oop menudriven program in python to perform following bank operations:
1.display balance
2.deposit
3.withdraw
4.add account
5.display all account information
6.exit
Solution
2.write oop menudriven program in python to perform following college operations:
Use inheritance
1.add student
2.add employee
3.add marks
4.display in sorted order of marks
5.exit
Solution
3.make a module which contains all arithmetic operation functions
Write a python program to import that module
And perform arithmetic operations
Solution
4.make a package which contains 2 modules:
1.to calculate areas of atleast 3 shapes
2. to calculate perimeter of atleast 3shapes
Use this package in python program to calculate area and perimeter
Solution
5.Define a class complex. And perform following operations:
1.add
2.subtract
3.multiply
Solution
6.define a class and demonstrate public,private and protected variables
Solution
7.create user defined exceptions :
1.if number entered is more than 50
2.if entered string is not a palindrome
Write python program to use above user defined exceptions
Solution
8.define a class and use all private variables
Use set and get methods in class to access them
e.g perform addition using this method
Solution
9. 1.demonstrate array index out of bound and arithmetic errors
2. demonstrate use of try except else block
Solution
10.write a program to demonstrate method overriding
Solution
11.A company wishes to perform analysis on most ordered food items in hotel
By different age groups.
Write a oop in python considering 3 classes 1.company,2.hotel,3.person (use inheritance)
Display most ordered food items in sorted order ( database can be used)
Solution
12.demonstrate single,multiple and multilevel inheritance.
Solution
13.write a python program to demonstrate Method Resolution order
Solution
14.create a module which contains following functions:
1. to check if string is palindrome
2.to check if no is Armstrong no or not
3.Fibonacci Series
Every function should return result
Write a python program to import that module and display various results
Solution
15.create a class player which has following attributes:
1.name 2.age 3.runs 4.wickets 5.team
Write a menu driven program to add,delete update player
Also sort players according to runs and display it.
Solution
Module 4: File Handling in python
1.Write a program to count the number of words in a file
(NOTE: Create your own text file)
Solution
2.Write a program to copy contents of one file into another
Solution
3.Write a program to find longest word in a file
Solution
4.Write a program to find a particular word in a file.
Solution
(Note: Word must taken as a input from the user.)
5.Write a program to write List into file.
Solution
6.Write a program to count number of lines in a file.
Solution
7.Write a program to count frequency of words in a file.
Solution
8.Write a program to remove newline characters from a file.
Solution
9.Write a program to append a text into a file
Solution
(NOTE: text is taken as a input from user)
10.Write a program to read first n lines into a fiile.
(NOTE: n is taken as a input from user)
Solution
Module 5: GUI and database in python
1.create a button and display message box on clicking button
Solution
2.create simple form which takes information and display information in text area
Solution
3.write a python program to create canvas
Solution
4.write a python program to update database table and display it
Solution
5. write a python program to insert data in database and display updated table
Solution
6.write a python program to delete data and display updated table
Solution
7.write a menu driven program to demonstrate food ordering system and store in database
And display it
Solution
8.write a menudriven program to perform insert , update,delete,display data using database connection
Solution
9.create a table of cars in database which includes model,name,color,country,price
Write a python program to display all data and display statistics of cars
1.which country has which type of max cars
2.car with max and min price
Solution
10.create a form using gui to take name,div,rollno and store data in database and display it
Solution
Module 6: Networking in Python
1) write a program to implement client server system using TCP
Solution
2) write a program to implement client server system using UDP
Solution
3) write a program to get the current time from server using TCP
Solution
4) write a program to get the current time from server using UDP
Solution