The document contains a series of Python programming exercises designed for Class IX students at Army Public School Pune. Each exercise includes a specific task, such as converting units, calculating percentages, checking divisibility, and determining maximum values among numbers. The document serves as a practical guide for students to practice and enhance their programming skills in Python.
The document contains a series of Python programming exercises designed for Class IX students at Army Public School Pune. Each exercise includes a specific task, such as converting units, calculating percentages, checking divisibility, and determining maximum values among numbers. The document serves as a practical guide for students to practice and enhance their programming skills in Python.
PART-B PYTHON PROGRAMMING 1. WAP to convert the value given in centimeter to inches. cm= int(input("Enter measure in cm: ")) inch=0.39*cm print(“measure in inch=”, inch) 2. WAP in python to calculate the percentage of a student who secured marks in 5 subjects out of 100 in each. e=int(input(“Enter English marks”)) h=int(input(“Enter Hindi marks”)) m=int(input(“Enter Maths marks”)) s=int(input(“Enter Science marks”)) ssc=int(input(“Enter ssc marks”)) total=e+h+m+s+ssc print(“Percentage=”,total*500/100) 3. WAP to check whether the number entered by the user is divisible by 6 or not. n= int(input("Enter a number : ")) if n%6 == 0 : print("Number is divisible by 6") else: print("Number is not divisible by 6") 4. WAP to find whether the number entered by the user is negative, positive or zero. n= int(input("Enter a number : ")) if n == 0 : print("Number entered is zero") elif n>0 : print("Number entered is positive") else: print("Number entered is negative") 5. WAP to input a day number from 1-7 and display day name as Sunday for 1, Monday for 2, and so on. weekday = int(input("Enter weekday day number (1-7) : ")) if weekday == 1 : print("\nMonday") elif weekday == 2 : print("\nTuesday") elif(weekday == 3) : print("\nWednesday") elif(weekday == 4) : print("\nThursday") elif(weekday == 5) : print("\nFriday") elif(weekday == 6) : print("\nSaturday") elif (weekday == 7) : print("\nSunday") else : print("\nPlease enter weekday number between 1-7.") 6. WAP to subtract smaller number from the larger number and display the difference. n1=int(input(“Enter number1”)) n2=int(input(“Enter number1”)) if (n1>n2): print (“Difference=”,n1-n2) else: print (“Difference=”,n2-n1) 7. WAP to check whether a character entered is a vowel or not. c=input(‘Enter a character’) if(c in [‘a’,’e’,’i’,’o’,’u’,’A’,’E’,’I’,’O’,’U’]) ): print(c,” is a vowel”) else: print(c,” is not a vowel”) 8. WAP to find maximum among 3 numbers. n1=int(input(“Enter number1”)) n2=int(input(“Enter number1”)) n3=int(input(“Enter number1”)) if (n1>n2 and n1>n3): print (n1,’is maximum’) elif(n2>n1 and n2>n3): print (n2,’is maximum’) else: print (n3,’ is maximum’) 9. WAP to accept the angles of a triangle & check if the triangle is equilateral. angle1-int(input ("Enter Angle:")) angle2= int(input("Enter Second Angle:")) angle3=t (input("Enter Third Angle")) if (angle1==angle2==angle3): printi(“lt is an equilateral triangle”) else: print("It is not an equilateral triangle") 10. Write a program to print lesser weight between two kids aman=int (input("Enter weight of Aman:")) jaya=int (input("Enter weight of Jaya :")) if(aman <jaya): print("Aman has lesser weight") else: print ("Jaya has lesser weight”) 11. write a program to check which vehicle(carl, car2 or car3) has the highest speed. car1=int (input("Enter distance covered by car 1 in 3 hour")) car2=int (input ("Enter distance covered by car 2 in 3 hours")) car3= int (input("Enter distance covered by car3 in 3 hours: ")) if (car1>car2): if car1>car3: print("Car 1 has highest speed") elif car3>car2: print("Car 3 has highest speed ") else: print("Car 2 has highest speed") 12. WAP to check if the member availing the ticket is above 18 years and is a club member, if yes cost of ticket is Rs. 5000 else Rs. 10000 age = int(input(“Enter your age”)) member = True if age > 18: if member: print("Ticket price is Rs. 5000.") else: print("Ticket price is Rs. 10000.") 13. WAP to input percentage marks and determine the grades as follows: Percentage marks Grades >=85 A 60-85 B 40-60 C <40 D p=float(input("Enter your percentage")) if(p>=85): print("Congratulations you are awarded A") elif(60<=p<85): print("Congratulations you are awarded B") elif(40<=p<60): print("You are awarded grade C") else: print("You are awarded grade D") 14. Apply the functions sum, max, min, len, count to the given list [14,56,5,5,45,78] . lst=[14,56,5,5,45,78] print('Sumof elements in list=', sum(lst)) print('Max value in list=', max(lst)) print('Min value in list=', min(lst)) print('Length of list=', len(lst)) 15. WAP to check if the number accepted from the user is present in the given list [14,56,5,5,45,78] lst=[14,56,5,5,45,78] n=int(input(' Enter a number')) if ( n in lst): print('elements ',n,'found in given list') else: print('elements ',n,' not found in given list')