Sei sulla pagina 1di 2

Summer Vacation 2019-20

Holidays Homework
Class XII Computer Science

1. What are variables and data types in Python? Explain with suitable example.
2. What are keywords in Python? Explain with suitable examples.
3. What are operators in Python? Explain all operators available in Python.
4. What is input(), eval() and print() functions in Python? Explain each with suitable examples.
5. What are comments in Python? Explain the types of comments in Python with example.
6. Explain with example:

(i) if statement
(ii) if.. else statement
(iii) if..else..if statement
7. What is for loop? Explain with syntax and suitable example.
8. What is while loop? Explain with syntax and suitable example.
9. Write short note on(Definition, Syntax and example):
(i) Strings
(ii) Lists
(iii) Tuples
(iv) Dictionary
10. Write short on :
(i) String Slicing
(ii) List Slicing
(iii) Tuple slicing
11. Write short note (purpose, syntax and example) on the following string methods:
(i) isalpha() (ii) isdigit() (iii) lower() (iv) islower()
(v) upper() (vi) isupper() (vii) Istrip() (viii) Rstrip()
(ix) isspace() (x) istitle() (xi) join() (xii) swapcase()
(xiii) partition() (xiv) ord() (xv) chr()

12. Write short note (purpose, syntax and example) on the following string methods:
(i) cmp() (ii) len() (iii) max() (iv) min()
(v) list() (vi) sum() (vii) appends() (viii) insert()
(ix) sort() (x) remove() (xi) reverse()

13. Write short note (purpose, syntax and example) on the following string methods:
(i) cmp() (ii) len() (iii) max() (iv) min()
(v) tuple()
14. Write short note (purpose, syntax and example) on the following string methods:
(i) cmp() (ii) len() (iii) str() (iv) type()
(v) clear() (vi) copy() (vii) keys() (viii) update()

15. Program to input two numbers and display their sum.


16. Program to find out the maximum, minimum and mean value from the inputted list.
17. Write a Python code to calculate simple interest by inputting the value of principal and rate
from the user for time period of 5 years.
18. Write a Python code to calculate and display the difference of two inputted numbers.
19. Write a Python code to illustrate nested if..else through a four function calculator.
20. Write a Python program to calculate income tax of an employee on the basis of basic salary
and total savings inputted by the user (using nested if …else statement) as per the given
slabs:
 No tax for individuals with income less that Rs. 2.5 Lakh
 0%-5% tax with income Rs. 2.5 Lakh to Rs. Rs. 5 Lakh for different age groups.
 20% tax with income Rs. 5 lakh to Rs. 10 lakh
 Investments up to Rs .1.5 lakh under sec 80 C can save up to Rs. 45,000 in taxes.
21. Write a Python code to generate Fibonacci series in a tuple.
22. Write a Python program to store students’ information like admission number, roll number,
name and marks in a dictionary and display information on the basis of admission number.
23. Covert the following for loop into while loop:
For k in range(10,20,5):
print(k)
24. Find errors in the following code(if any) and correct the code by rewriting it and undrlining
the corrections :
25. X=int(“Enter value for x:”))
for in rage [0,11]:
if x=y
print x+y
else:
Print x-y

26. Write the output of the following code when executed :


Text=”yahoomail.com”
L=len(Text)
Ntext= “”

for i in range (0,1):

If Text[i].isupper():
ntext=ntext+Text[i].lower()
elif Text[i].isalpha():
ntext=ntext+Text[i].upper()

else :

ntext=ntext+ ‘%%’

print(ntext)

27. How many times is the word ‘Hello’ printed in the following statement?
s= ‘ Class XII rocks’
for ch in s{3:8]:
print (‘Hello’)

Potrebbero piacerti anche