Chapter 6 Basic Python Programs
Chapter 6 Basic Python Programs
Sum = A+B
2. Program to print
My Name is Ruhaan
My Name is ‘Ruhaan’
My Name is “Ruhaan”
If A>B :
Else :
Perim = 4 * Side
Pi = 3.14
Circum = 2* Pi * R
Area = Pi * R * R
7. Write a program to print adult if age is greater than or equal to 18 otherwise not an adult.
Accept age from user
8. Write a program to print the square if the number entered is even, otherwise print its cube.
Algo
2: input number
3: if (number % 2 == 0)
else
9. Write a program to accept the 2 sides of a rectangle and display if its area is greater than its
perimeter.
10. Write a program to Input two numbers and a choice from a user. The program should
display the calculated result after performing the required mathematical operation
depending on the choice.
1. A+B
2. A-B
3. A/B
4. A*B
11. WAP to accept basic salary and grade from user. Calculate and display net salary
net salary = basic salary + hra +da +allow-pf. Print all details.
12. Write a program to accept marks of 5 subjects. Calculate total, percentage and acquired
division based on following criteria.
If the student’s percentage is more than 80%, display “Eligible for scholar badge”
otherwise display “Not eligible “
13. Write a program to input three numbers and display the largest.
14. Write a program to accept 3 numbers from users. Display the numbers in descending order.
output :
This is a bright sunny day
a. This$is$a$bright$sunny$day
This…is…a…fine…day
b. This…is…a…bright…sunny…day$This…is…a…fine…day
16. Write a program to input number of seconds from the user and calculate the number of
hours, minutes and seconds.
Seconds = Seconds % 60
Dry Run:
7 – 789 – 700 + 80 + 9
X, Y = X+Y , Y + Z
19. Program to input Name , Class and age of a student and print it.
Example : Shaurya , 11 , 15
C * 9/5 +32 = F