Python Built in Function

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

OMSAKTHI

G B PUBLIC SCHOOL
CLASS XII REVISION SHEET
Python Built-in-functions Questions
1. Write the output of the code given below: 2 MARK IN YOUR BOARD
list= [10, 20, 30, 40, 50, 60, 70, 80] EXAM Q.NO 23
print(list[ : : -2])

2. Write the output of the code given below:


squares = {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
print(squares.pop(4))

3. Write the equivalent Python statement for the following.


a. Insert an element 10 to the 2nd index of the list L
b. Delete the dictionary D along with its contents from the memory.

4. Rahul wants to round a number down to the nearest smallest integer. Write the
Python commands to import the required module (using built-in function) and
display the nearest smallest integer to the given number x.

5. Write a Python statement for each of the following tasks using BUILT-IN
functions/methods only.
(i) To find the minimum value from a list named ‘Numbers’.
(ii) To find and print the length of words from the list.

6. Write the Python statement for each of the following tasks using BUILT-IN
functions/methods only:
(i) To insert an element 200 at the third position, in the list L1.
(ii) To check whether a string named, message ends with a full stop / period or not.

7. A list named studentAge stores age of students of a class. Write the Python command
to import the required module and (using built-in function) to display the most
common age value from the given list.

8. Write a suitable Python statement for each of the following tasks using built-in
functions/methods only:
i To delete an element Mumbai:50 from Dictionary D.
ii To display words in a string S in the form of a list

9. Write a Python Program to display alternate characters of a string my_str.


For example, if my_str = "Computer Science"
The output should be Cmue cec

10. Write the Python statement for each of the following tasks using BUILT-IN
functions/methods only:
i. To return index position of substring in given string.
ii. To delete first occurrence of an item in the list
11. A list named stu_marks stores marks of students of a class. Write the Python
command to import the required module and display the average of the marks in
the list.

12. Write the Python statement/function for each of the following tasks using BUILT-IN
functions/methods only:
i. To return index position of substring in given string.
ii. To delete first occurrence of an item in the list

13. A list named stu_marks stores marks of students of a class. Write the Python
command to import the required module and display the average of the marks in
the list.

14. Write the Python statement for each of the following tasks:
(i) str="PYTHON@LANGUAGE"
To print the above string from index 2 onwards using a single statement.
(ii)To initialize an empty dictionary named as d using BUILT_IN
fuctions/ methods only

15. Write the Python statement for each of the following tasks using BUILT_IN
fuctions/ methods only:
(i) s=”LANGUAGE"
To convert the above string into list.
(ii)To initialize an empty tuple named as t.

16. Write the Python statement for each of the following tasks using BUILT-IN
functions/methods only:
i) To Join all items in a tuple( t) into a string( x ), using a hash character as
separator:
ii) To sort a list (L1) in descending order and returns a new sorted list (L2)
without changing the original list

17. A list named studentAge stores age of students of a class. Write the Python
command to import the required module and (using built-in function) to
display the most common age value from the given list.

18. Write the Python statement for each of the following tasks using BUILT-IN
functions/methods only:
(i) To insert an element 400 at the fourth position, in the list L1.
(ii) To check whether a string named, message ends with a full stop / period or not.

You might also like