0% found this document useful (0 votes)
15 views2 pages

Programs Based On Functions - Practical

The document outlines various Python programming tasks focused on user-defined functions, including calculating factorials, finding areas of geometric shapes, performing arithmetic operations, displaying prime numbers, and finding HCF. It also includes functions for grading students based on scores and manipulating strings by replacing certain characters. Additionally, it describes a function to return indices of list elements divisible by 3.

Uploaded by

adi.chauhan.483
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)
15 views2 pages

Programs Based On Functions - Practical

The document outlines various Python programming tasks focused on user-defined functions, including calculating factorials, finding areas of geometric shapes, performing arithmetic operations, displaying prime numbers, and finding HCF. It also includes functions for grading students based on scores and manipulating strings by replacing certain characters. Additionally, it describes a function to return indices of list elements divisible by 3.

Uploaded by

adi.chauhan.483
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
You are on page 1/ 2

Programs Based on Functions

1. Write a program in Python to find factorial for the given number using user
defined function
2. Write a Menu driven program to find the area of Circle, Rectangle and
Triangle using function.
3. Writer a Menu Driven program to perform arithmetic operations((+,-,*, /,%)
using functions.
4. Write a program to display the prime no’s in a given range using functions.
5. Write a program using function to find the HCF of numbers present in the
list(solution below)
6. Write a user defined function in Python named showGrades(S) which takes
the dictionary S as an argument.
The dictionary S contains Name : [Phy,Chem,Maths] as key:value pairs .
The function displays the corresponding grade obtained by the students
according to the following grading rules:

7. Write a user defined function in Python named Puzzle(W,N) which takes the
arguement W as an English word and N as an integer and returns the string
where every Nth alphabet of the word W is replaced with an underscore("_")
For example: if W contains the word "TELEVISION" and N is 3, then the
function should return the string "TE_EV_SI_N" . Likewise for the word
"TELEVISION" if N is 4, then the function should return "TEL_VIS_ON"
8. Write a function LIST_IND(L), where L is the list of elements passed as
argument to the function. The function returns another list named indexList that
stores the indices of all Elements of L that are divisible by 3.
For example: If L contains [12,4,0,11,0,51]
The indexList will have - [0,5]

Solutions:
5.

You might also like