Programming and Problem Solving Through Python (M3-R5)
O level Practical Question With Solution
i. Write a program to print all Armstrong numbers in a given range. Note: An Armstrong number is a number whose sum of cubes of digits is equal to the number itself. E.g.
370=33+73+03
ii. Write a function to obtain sum n terms of the following series for any positive integer value of X
X +X3 /3! +X5 /5! ! +X7 /7! + …
iii. Write a function to obtain sum n terms of the following series for any positive integer value of X
1+x/1!+x2/2!+x3/3!+…
iv. Write a program to multiply two numbers by repeated addition e.g.
6*7 = 6+6+6+6+6+6+6
v. Write a program to compute the wages of a daily laborer as per the following rules :-
Hours Worked Rate Applicable Upto first 8 hrs Rs100/-
a) For next 4 hrs Rs30/- per hr extra
b) For next 4 hrs Rs40/- per hr extra
c) For next 4 hrs Rs50/- per hr extra
d) For rest Rs60/- per hr extra
vi. Accept the name of the labourer and no. of hours worked. Calculate and display the wages. The program should run for N number of laboures as specified by the user.
vii. Write a function that takes a string as parameter and returns a string with every successive repetitive character replaced by ?e.g. school may become scho?l.
viii. Write a program that takes in a sentence as input and displays the number of words, number of capital letters, no. of small letters and number of special symbols.
ix. Write a Python program that takes list of numbers as input from the user and producesa cumulative list where each element in the list at any position n is sum of all elements at positions up to n-1.
x. Write a program which takes list of numbers as input and finds:
a) The largest number in the list
b) The smallest number in the list
c) Product of all the items in the list
xi. Write a Python function that takes two lists and returns True if they have at least one common item.
xii. Write a Python program to combine two dictionary adding values for common keys.
d1 = {'a': 100, 'b': 200, 'c':300}
d2 = {'a': 300, 'b': 200, 'd':400}
Sample output: Counter({'a': 400, 'b': 400, 'd': 400, 'c': 300})
xiii. Write a program that takes sentence as input from the user and computes the frequency of each letter. Use a variable of dictionary type to maintain and show the frequency of each letter.
xiv. Apply recursive call to do the following:
a) Product of two numbers using repetitive addition
b) Print Fibonacci series upto term n
xv. Write a program to input two numbers as input and compute the greatest common divisor.
xvi. Write a function that takes two filenames f1 and f2 as input. The function should read the contents of f1
by
and write them onto f2.
xvii. Write a function that reads the contents of the file f3.txt and counts the number of alphabets, blank spaces, lowercase letters, number of words starting with a vowel and number of occurrences of a work “hello”.
xviii. Write a program to replace ‘a’ with ‘b’, ‘b’ with ‘c’,….,’z’ with ‘a’ and similarly for ‘A’ with ‘B’,’B’ with ‘C’, …., ‘Z’ with ‘A’ in a file. The other characters should remain unchanged.
xix. Write a NumPy program to find the most frequent value in an array.
xx. Take two NumPy arrays having two dimensions. Concatenate the arrays on axis 1.
Tags:
O level Previous year Paper o level practical paper 2021,
O level paper 2021,
O level paper name,
O level Previous year solved paper,
1 Comments
sir python enote kab tak mil sakte hai
ReplyDeleteHey, What do you think about this post