Basics of Python
Note: To be done on Python IDLE and share in the form of google doc/ word file.
1. Write a Python Program to find the total and average for given marks.
2. Write a Python Program to find the sale price of an item with a given cost and
discount (%).
3. Write a Python Program to calculate the perimeter/circumference and area of
shapes such as triangle, rectangle, square and circle.
4. Write a Python Program to Calculate Simple and Compound Interest. 5. Write
a Python Program to calculate profit-loss for a given Cost and Sell Price.
6. Gunjan 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 (e.g., if a user enters -35, she wants to take 35). Help Gunjan 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.
7. Write a Python Program to Convert Kilometers to Miles
8. Write a Python Program to Convert Celsius To Fahrenheit
9. Write a Python Program to Check if a Number is Positive, Negative or 0 .
10. Write a script to input principal, time and calculate simple interest. If time
is more than 10 years, calculate simple interest at the rate of 8% p.a.,
otherwise calculate it at the rate of 12% p.a.
11. Write a Python Program to Check for Leap Year.
12. Write a script to input a number and check whether it is even or odd, and
then display an appropriate message.
13. Write a script to input a number. If the number is even, print its square,
otherwise print its cube.
14. Write a menu driven script to calculate the total surface area and volume of a
cube, cuboid, or sphere depending upon the user's choice.
15. Write a Python Program to make a Simple Calculator.
16. Write a script which inputs three numbers from the user and displays these
numbers in ascending order.
17. Write a Python script to input two numbers from the user and store these values in
two different variables. Then interchange (swap) the values of these two variables using
a third variable.
18. Rewrite the above script, but this time to swap the values of variables without using
the third variable.
19. Write Python script to input a time duration in seconds and display it in the
following :
____________ Seconds = _____ hr ________ min _______ seconds. For
example, if the user input is 4526, the output should be:
4526 seconds = 1 hr 15 min 26 seconds