0% found this document useful (0 votes)
2 views1 page

02 Practicals Python Functions

The document presents a series of practical questions related to Python functions. It includes tasks such as creating functions for digit extraction, counting characters in place names, calculating volumes, and manipulating lists. Each question outlines specific requirements for the function to be implemented.

Uploaded by

abir.jersey21
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

02 Practicals Python Functions

The document presents a series of practical questions related to Python functions. It includes tasks such as creating functions for digit extraction, counting characters in place names, calculating volumes, and manipulating lists. Each question outlines specific requirements for the function to be implemented.

Uploaded by

abir.jersey21
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Functions

Functions Practical Questions

1. Write a function that takes a positive integer and returns the one’s position digit of the
integer.
2. Write a function countNow(PLACES) in Python, that takes the dictionary PLACES as an
argument and displays the names (in uppercase) of the places whose names are longer than
5 characters.
Example: PLACES={1:"Delhi",2:"London",3:"Paris",4:"New York",5:"Doha"}
Output:
LONDON
NEW YORK
3. Write a function namely FUN that takes no parameters and always returns None.
4. Write a function that takes amount-in-dollars and dollar-to-rupees-conversion-price. It then
returns the amount converted to rupees.
5. Write a program to have the following functions:
a. A function that takes a number as an argument and calculates the cube for it.
The function does not return a value. If there is no value passed to the function
in the function call, the function should calculate a cube of 2.
b. A function that takes two character arguments and returns TRUE if both the
arguments are equal otherwise FALSE.
6. Write a function that:
a. Asks the user to input a diameter of a sphere(centimeters, inches,etc.)
b. Sets a variable called radius to one-half of that number.
c. Calculates the volume of a sphere using this radius and the formula:
Volume: 4/3 pi * r* 3
d. Prints a statement estimating the volume of the sphere; include the appropriate unit
information in liters or quarts.(NOTE that there are 1000 cubic cm in a litre and 57.75
cubic inches in a quart)
Returns this same amount as the output of the function
7. Write a function in Python to find the maximum of three numbers
8. Write a function in Python to sum all the three numbers in a list.
Sample list: (4, 6, 3, 5, 6)
output: 24
9. Write a function remove_element() in Python that accepts a list L and a number n. If the
number n exists in the list, it should be removed. If it does not exist, print "Element not
found".
10. Write a function that accepts string and calculates the number of uppercase letters and
lowercase letters.
11. Write a function to print even numbers from a given list
12. Write a function lenWords(STRING) that takes a string as an argument and returns a tuple
containing the length of each word of the string.
Example: "Come let us have some fun" → (4, 3, 2, 4, 4, 3)

Page | 1 Grade 12 |Computer Science | 2026-27

You might also like