Python Programming

Syllabus, Assignments Questions

Section 1 - Basic codes, I/O, Operators & Expressions
- Installation of Python - Interactive, script and online modes. - Print Statements - Input function , int() ,float() and str() conversion. - Data types and Variable , Integer, Float, String - Arithmetic Operator - Relational & Logical Operator - Assignment Operator - Identity & Membership Operators - Precedence & Order of Evaluation

S.No Question
*1. Write a program to print given format using print function.
*
**
***
*****
******
*******
*2. simple arithmetic operations, circumference.
*3. Write a program to find out simple interest (SI).
*4. Write a program to find gross salary (Hint :-GS=BS+DA+TA).
*5. Write a program for swapping of two integer variables using third variable.
*6. Write a program for swapping of two integer variables Without using third variable.
*7. Write a program to print last digit of a given number.
*8. Write a program to calculate Compound Interest.
S.No Question
#1. Write a program to find out square of given number.
#2. Write a program to find out area of a circle.
#3. Write a program accept 5 subject marks (Hint P=67, C=87, M=90, H=98, E=88) and calculate total marks and percentage.
#4. Write a program accepts three numbers from user and calculate average of given three numbers.
#5. Write a program to accepts an amount in rupees (Hint Rs4567) and find out how many currency of Rs 2000 required. Also find remaining amount.
#6. Write program to find power of a number using pow function.0000000000000.1
#7. Write a program to convert temperature from degree Fahrenheit to Celsius.
#8. Write a program to convert days into years, weeks and months.
#9. Write a program to flip bits of a binary number using bitwise operator.
#10. Find sum of first , third and fifth digit of 6 digit number.
Section 2 - Flow Control (Conditional Statements)
- If - If-Else - Else-If - Nested If-Else

S.No Question
*1. Write a program to accepts a number from user and check given number is even or odd.
*2. Write a program to accepts two numbers from user and calculates first no is divisible by second or not.
*3. Write a program to accepts three numbers from user and calculate biggest number out of three numbers.
*4. Write a program to calculate whether character is in lowercase or uppercase.
*5. Write a program to input basic salary of an employee and calculate its Gross salary according to following:
Basic Salary <= 10000 : HRA=20%, DA=80%
Basic Salary <= 20000 : HRA=25%, DA=90%
Basic Salary > 20000 : HRA = 30%, DA = 95%
Gross Salary = Basic Salary + HRA + DA
*6. Write a program to find maximum between two numbers.
*7. Write a program to find maximum between three numbers using if-else and ternary operator.
*8. Write a program to calculate sum of digits of a number of three digit number using if-else.
*9. Write a "Bonus Distribution Program" using logical operators. Bonus will be given to all those employees who have salary less than 20000 and tenure is more than 3 years.
*10. Write a code (using nested switch case) to suggest a diet plan (calories) to a consumer on behalf of inputs(gender and food time).
S.No Question
#1. Write a program that accepts the age of person, find out the person is eligible for voting or not.
#2. Write a program that accepts a number from user and find whether it is positive or negative or zero.
#3. Write a program to calculate whether year is leap year or not.
#4. Write a program that accepts five subjects8 marks from user and calculate the total marks then calculate Percentage. Display message according to following condition:
Percentage >=60 then print message Grade A
Percentage >=50 then print message Grade B
Percentage >= 40 then print message Grade C
Percentage < 40 then print message Grade D.
#5. Write a program for generating electricity Bill. Accept last month unit and current month unit from user, then calculate and print bill amount according to following condition:
0-150 charges 4 rs/unit
151-300 charges 6 rs/unit
301-500 charges 8rs/unit
>500 charges 10rs/unit.
#6. Write a program to find the greatest of four numbers entered by the user.
#7. Write a program to calculate the income tax of an employee.
The tax slabs according to annual salary are :
upto rs.300000 tax is 0%
from rs.300000 to rs. 500000 tax is 10%
from rs.500000 to rs. 1000000 tax is 15%
more than 100000 tax is 20%
Note: 250000 is exempted from tax criteria
#8. Write a code for call center (using nested switch case). E,g, 1 for prepaid, 2 for post paid. If 1 selected then show all the options for prepaid.
Section 3 - Flow Control(Loops)
- While Loop & Else - Break & Continue - For Loop & Else - Range function

S.No Question
*1. Write a program to print "Code Better” five times by using loop.
*2. Write a program to print n natural number.
*3. Take any ten numbers from user and print sum and average of these numbers.
*4. Take any ten numbers from user and print sum and average of positive numbers.
*5. Take the numbers from user (until ten +ve numbers entered by the user), and print sum and average of these numbers.
*6. Write a program to calculate factorial of a given number.
*7. Write a program to calculate sum of digits of a number.
*8. Write a program to find out reverse of a given number.
*9. Write a program that accepts a number from user and check given number is Armstrong number or not.
*10. Write a program to find LCM of two numbers.
.e.g. LCM of 4 and 6 is 12.
*11. Write a program to find HCF of two numbers.
.e.g. HCF of 16 and 24 is 8.
*12. Write a program that accepts a number from user and check given number is prime number or not.
*13. Print Fibonacci series unto n terms 0,1,1,2,3,5,8,……
*14. Write a program to print given below patterns:
    * * * * *
    * * * * *
    * * * * *
  
    *
    * *
    * * *
    * * * *
  
    A
    AB
    ABC
    ABCD
    ABCDE
  

      *
     * *
    * * *
  * * * * *
* * * * * * * 
    * * * * *
     * * * *
      * * *
       * *
        *
  
    1 2 3 4 5
    1 2 3 4 5
    1 2 3 4 5
    1 2 3 4 5
    1 2 3 4 5
  
S.No Question
#1. Write a program to calculate square of numbers between 1-10.
#2. Write a program to calculate cube of numbers between m and n. Ask user to enter value of m and n.
#3. Write a program to print table of any given numbers. . e.g table of 5 is 5, 10, 15,…,50.
#4. Write a program that accepts a number from user and check given number is palindrome number or not. e.g palindrome number is 16761.
#5. Write a program that accepts a number from user calculate factor of a given number.
.e.g. factors of 12 are 1,2,3,4,6,12.
#6. Write a program that accepts a number from user check given number is perfect number or not. A perfect number is whose sum of factors is wise of that numbers. e.g. factor of 6 are 1,2,3,6 then sum of 1+2+3+6=12.
#7. Write a program to accept N number from user and show how many number are even or odd.
#8. Write a program to accept N number from user and check and print only Prime numbers.
#9. Write a program to accept N number from user and check and print only Armstrong numbers.
#10. Write a program to accept N number from user and check and print only palindrome numbers.
#11. Write a program to calculate sum of given series: 1-2+3-4+5-6+7-8……n.
#12. Write a program to calculate sum of given series: x + x^2 + x^3 + …….+x^n
#13. Write a program to print given below patterns:
    1
    12
    123
    1234
  
    5
    54
    543
    5432
    54321
  
    5 4 3 2 1
    5 4 3 2 1
    5 4 3 2 1
    5 4 3 2 1
  
       1
       1 2
     1 2 3
   1 2 3 4 
 1 2 3 4 5   
  
      1
     1  1
    1  2  1
   1 3   3 1
  1 4  6  4 1
  
    * * * * *
    *       *
    *       *
    *       *
    * * * * * 
  
          * *
        * * * *
      * * * * * *
    * * * * * * * *
  * * * * * * * * * *
  * * * * * * * * * *
    * * * * * * * *
      * * * * * *
        * * * *
          * *
  
  *                 *
  * *             * *
  * * *         * * *
  * * * *     * * * *
  * * * * * * * * * *
  * * * * * * * * * *
  * * * *     * * * *
  * * *         * * *
  * *             * *
  *                 *
  
#14. Print first letter of your name using start pattern.
Section 4 - Sequences/Collections
- Strings - Tuples - Set - List - Dictionary

S.No Question
*1. Write a program to read and print elements of tuples, set & List.
*2. Write a program to find sum of all tuple elements.
*3. Write a program to find maximum and minimum element in a List.
*4. Write a program to insert an element in a List.
*5. Write a program to add two matrices.
*6. Write a program to search an element in a List.
*7. Write a program to sort an List/Set.
*8. Write a program to reverse elements of an Set/List.
*9. Write a program to Fetch the members of Dictionary.
*10. Write a program to create a Set & List with the Key & Value of a Dictionary.
*11. Write a Program to find total number of alphabets, digits or special character in a string.
*12. Write a Program to convert lowercase string to uppercase.
*13. Write a Program to find reverse of a string.
S.No Question
#1. Write a program to count total number of even and odd elements in an Tuple/List.
#2. Write a program to copy all elements from an array to another List/Set.
#3. Write a program to count total number of duplicate elements in an List.
#4. Write a program to merge two array to third List.
#5. Write a program to sort List elements in ascending or descending order.
#6. Write a program to multiply two matrices.
#7. Write a program to check whether two matrices are equal or not.
#8. Remove all duplicate occurring elements from List.
#9. Ask user to enter any four numbers between 1 to 9 and create a dictionary using the numbers made using combination of these four number. Do not repeat any digit in the same number.
#10. Find 2nd highest number from and 2nd minimum from List of n elements.
#11. Find the common members from 2 set of employees using set.
#12. Find the common members from first set of employees who are not available in 2nd Set.
#13. Write a program to count total number of vowels and consonants in a string.
#14. Write a program to find first occurrence of a character in a given string.
Section 5 - Functions
- Function Declaration and Types - Function Parameters - Required, Kwargs, Default and variable length arguments - Call by value & Call by reference - Lambda expression.

S.No Question
*1. Write a program to find cube of any number using function.
*2. Write a program to check whether a number is even or odd using functions.
*3. Write a program to find sum of digits of a given number using function.
*4. Write a program to check whether a number is palindrome or not.
*5. Write a program to find out the square of a function using lambda.
*6. Write a program to find out the reverse of a function using lambda.
S.No Question
#1. Write a program to check the prime number using function with argument and no return type.
#2. Write a program to calculate factorial using function with argument and with return type.
#3. . Write a program to print all even or odd numbers in given range using function.
#4. Write a program to find LCM of two numbers using function.
#5. Write a Program to print all natural numbers between 1 to n using function.
Section 6 - OOPS
- Introduction to OOP , - Object , Class, Methods, - self, static, List of object - initializer, delete and str methods - Inheritance, types of Inheritance - Method Overriding - Super - Abstract class,run-time polymorphism

S.No Question
*1. Create a class to calculate Area of circle with one data member to store the radius and another to store area value.
Create method members
1. init - to input radius from user
2. calc - to calculate area
3. display- to display area.
*2. Create a program using init,del & str function to perform all the read, write and access function of a file.
*3. Create a class MathOperation with two data member X and Y to store the operand and third data member R to store result of operation.
Create method members
● init - to input X and Y from user
● add - to add X and Y and store in R
● multiply - to multiply X and Y and store in R
● power - to calculate X Y and store in R
● display- to display Result R
*4. Enter the marks of 5 students in Chemistry, Mathematics and Physics (each out of 100) using a structure named Marks having elements roll no., name, chem_marks, maths_marks and phy_marks and then display the percentage of each student.
*5. Create a Bus child class that inherits from the Vehicle class. The default fare charge of any vehicle is seating capacity * 100. If Vehicle is Bus instance, we need to add an extra 10% on full fare as a maintenance charge. So total fare for bus instance will become the final amount = total fare + 10% of the total fare.
*6. Create class Product (pid, price, quantity) with parameterized init. Create a main function in different class (say XYZ) and perform following task: a. Accept five product information from user and store in an array b. Find Pid of product with highest price. c. Create method (with array of product’s object as argument) in XYZ class to calculate and return total amount spent on all products. (amount spent on single product=price of product * quantity of product).
S.No Question
#1. Write a Program to create Book Details using class.
#2. Write a Python class named Rectangle constructed by a length and width and a method which will compute the area of a rectangle.
#3. Write a program to store and print the roll no., name, age, address and marks of 15 students using class.
#4. Write a class to store the roll no., name, age (between 11 to 14) and address of students (more than 10). Store the information of the students.
1 - Write a function to print the names of all the students having age 14.
2 - Write another function to print the names of all the students having even roll no.
3 - Write another function to display the details of the student whose roll no is given (i.e. roll no. entered by the user).
#5. Create a bank account with support for deposit and withdraw operations as well as balance enquiry option.
#6. Write program to override the int method of RBI by 3 different child (SBI,PNB,CANARA).
Section 7 - Exception Handling
- Exceptions - try, except, raise, else, finally, - custom exception

S.No Question
*1. Write a program to Handle multiple exception along with else and finally block.
*2. Write a program to check whether 1st number is visible by 2nd or not.
*3. Write a program to raise an Exception if the give input is more than 50.
S.No Question
#1. Write a program to Handle zero division exception , else and finally block.
#2. create a custom exception to check whether the commission of an employee should not be more than 30% of the his/her Salary.
Section 8 - File Management
- Enumeration, File Handling, CSV read, write

S.No Question
*1. Write a program to read a text file character by character and write its content on console.
*2. Write a program to read numbers from a file and write even, odd and prime numbers to separate file.
*3. Write a Program to copy contents from one file to another file.
*4. Write a program to write multiple lines in a text file.
*5. Write a Program to write a CSV file with 5 student details(collect by the user).
*6. Read Students marks from a csv file and calculate the result.
S.No Question
#1. Take name and salary of two employees as input from the user and write them to a text file.
#2. Write a program to read three integers from a file.
#3. Write a program to print source code of same program.
#4. Write a program to merge two file to third file.
#5. Write a program to count a number of words and characters in a file.
#6. Write a Program to collect the information of some employees and write it into a CSV file.
Section 9 - Mini Project Ideas

S.No Question
1. Create a Student Management System to store , delete, update list records of student. Store rollno, name, course, semester , percentage
2. Create BankAccount Management App to store , delete, update, list, deposit, withdraw, search records of Bank Account. Store accNo, customer name, balance, account type.
3. Create CodeBetter enquiry system to store, delete, update, list, search enquiry details. Store enquiry details like candidate name, contact, address, course selected, course fee.

Contact Us

Our Address

Office no.- 401,Shekhar Central Building ,Palasiya, Pin-code:452001, Indore

Email Us

contact@codebetter.in

Call Us

+91 88230 75444, +91 99939 28766

Loading
Your message has been sent. Thank you!