Page 164 - CodePilot V5.0 C8
P. 164
LEARNING LOGS
A. Tick ( ) the correct option.
1. Choose the Python function that converts a string to lowercase.
(i) lower() (ii) upper()
(iii) capitalize() (iv) title()
2. Which keyword is used to exit a function in Python?
(i) exit (ii) break
(iii) return (iv) end
3. Identify the built-in Python function used to calculate the length of a string.
(i) len() (ii) count()
(iii) max() (iv) sum()
4. Mark the correct method that adds all items from another list to the current list in Python.
(i) append() (ii) insert()
(iii) extend() (iv) pop()
5. Select the function in Python used to get the square root of a number.
(i) math.exp() (ii) math.sqrt()
(iii) math.ceil() (iv) math.floor()
B. Write ‘T’ for true and ‘F’ for false.
1. Functions make code reusable and modular.
2. String concatenation is done using the * operator.
3. The append() method removes the last element from the list.
4. The math module must be imported before its functions can be used.
5. In list slicing, the step parameter is compulsory.
C. Fill in the blanks using the given hints:
1. Every function definition must begin with the keyword.
Hints
2. functions are created by the programmer to perform custom tasks. Positive
List
3. indexing starts from the left, with the first character at index 0. randint()
4. A in Python can store multiple values in a single variable. User-defined
def
5. The method returns a random integer within a specified range.
162
CodePilot (V5.0)-VIII

