100+ Python Program Collections for Grade IX
SEE COMPUTER SCIENCE GRADE IX 2082
6.
Practise these practical questions.
Input/Output
a) Write a program to ask input as “name” from the user and greet the user as he/she provides their name.
b) Write a program to input 3 sides of triangle and print area
c) Write a program to input a radius and find the area of circumference of circle
d) Write a program to input 3 digits as integers and calculate their sum and average.
e) Write a program to input a diameter and print area of circle and circumference of circle
Constant value and Operators
a) Write a program to input a radius and find the area of circumference of the circle
b) Write a program to show the use of arithmetic operators. (Perform add, subtract, multiply, divide, square and modulus between two numbers)
c) Write a program to show the use of a comparison operator between two variables. (Use the following operators. ==, <=, >=, !=)
If…..else Statement
a) Write a program using the if statement to check whether the given number is positive.
b) Write a program that takes people’s age as input and checks whether they are eligible to vote. (Voting age is 18 and above)
c) Write a program to check whether the given number is even or odd using
an if-else statement.
d) Write a program to input two numbers and find the smallest number.
e) Write a program that takes students’ marks as an input and checks whether the student passed or failed. (40 or greater is pass marks)
f)
Write a program that takes 3 numbers as inputs and displays the smallest number.
g) Make a program like a traffic light using an if-elif-else statement. Ask input from the user on providing color. (green=go, red=stop and orange=be ready, any other color=invalid color)
h) Write a program to input practical and theory marks of Computer and check pass or fail. You can also validate whether a user has entered valid marks or not. (valid marks should be checked for both theory and practical)
For loop
a) Write a program to print numbers from 1-15.
b) Write a program to print an input name 20 times.
c) Write a program to print the squares of numbers from 1 to 5 using a for loop.
d) Write a program to print first 20 odd numbers
e) Write a program that takes an integer as input and prints the multiplication table for that number.
While loop
a)
Write a program to print numbers from 1-20.
b) Write a program to print first 30 even numbers.
c)Write a program to calculate the factorial of a given number.
d) Write a program to print the sum of the first 20 odd numbers.
e)Write a program to input multi digits numbers and display the sum of the digits.
Write a Python program to create a list of 5 integers and print the list.
Write a Python program to print the second and fourth elements of a list.
Write a Python program to append a new element to the end of a list and print the updated list.
Write a Python program to print the first three elements of a list using slicing.
Write a Python program to print the length of a list.
Write a Python program to iterate through a list and print each element.
Write a Python program to create a list of squares of numbers from 1 to 10 using list comprehension.
Write a Python program to remove the third element from a list and print the updated list.
Dictionaries
Write a Python program to create a dictionary with 3 key-value pairs and print the dictionary.
Write a Python program to print the value associated with a specific key in a dictionary.
Write a Python program to add a new key-value pair to a dictionary and print the updated dictionary.
Write a Python program to remove a key-value pair from a dictionary using the del statement and print the updated dictionary.
Write a Python program to iterate through a dictionary and print all the keys.
Write a Python program to create a dictionary where the keys are numbers
from 1 to 5 and the values are their squares using dictionary comprehension.
Write a Python program to check if a specific key exists in a dictionary.
Write a Python program to merge two dictionaries and print the resulting dictionary

No comments:
Post a Comment