Practicals – Python Basics

Control Statements

1. Sequential

Write a Program to calculate

  1. Area of rectangle
  2. Area of circle
  3. Area of cuboid
  4. Area of cube
  5. Area of TSA of cylinder
  6. Area of CSA of cylinder
  7. Area of CSa of cone
  8. TSA of sphere
  9. Volume of cuboid
  10. Volume of cube
  11. Volume of cylinder
  12. Volume of cone
  13. Volume of sphere
  14. Perimeter of rectangle
  15. Area of square
  16. Area of triangle

17. A menu driven program to calculate the total surface area and volume of a cube, cuboid, or sphere depending upon user’s choice. The program should continue until the user selects the option to exit the program.

2. Conditional

3. Looping

  1. To find given number is even or odd
  2. Find greatest no. In four no.
  3. To check division in result
  4. To check age criteria
  5. Sum of nth no.
  6. To find the sum of first n natural numbers, where n is to be input from the user.
  7. To check the value of factorial
  8. To input a number and display its first 10 multiples
  9. To print multiplication table
  10. To print opposite right angle triangle
  11. Ruhi wants to write a script to input the number of students of a class and perform some processing. She knows that sometimes the user may enter a negative number for the number of students. In such a case, she wants to take the positive value of the number (ex., if user enters -35, she wants to take 35). Help Ruhi by writing the part of the script which inputs the number of students in a class and converts it into a positive number if it is negative.

Pattern

1.
2.
3.
4.
  1. To print star pattern of opposite triangle
  2. To print pattern 1,12,123
  3. x + x2 + x3 + . . .
  4.  x – x2 + x3 + . . .
  5. xx
  6. 1+ x + 2 + 3 + . . .
  7. xx3
  8. 1+ x + 2! + 3! + . . .
  9. 1- x +xxx7+ . . . 
  10. 1+3!+5!+7!.. .
  11. xxx
  12. 1- + – …
  13. 1 12 123
  14. 1 121 12321 1234321 .
  15. 3! 5! 7!

Data Structures

  1. List: To create a list of values inputted by user
  2. Dictionary: Python to create a phone dictionary
  3. Tuple: To create a tuple of values inputed by user
  4. Linked List

Sorting

  1. Sorting in ascending order use bubble sort
  2. Inputs ‘n’ numbers from the user and displays these numbers in ascending order.