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

Python Functions for Data Processing

The document outlines six Python programming tasks involving functions. These tasks include sorting strings, identifying prime palindromes, counting characters in a string, displaying uppercase place names, calculating word lengths, and generating a Fibonacci series. Each task specifies the input parameters and expected output format.

Uploaded by

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

Python Functions for Data Processing

The document outlines six Python programming tasks involving functions. These tasks include sorting strings, identifying prime palindromes, counting characters in a string, displaying uppercase place names, calculating word lengths, and generating a Fibonacci series. Each task specifies the input parameters and expected output format.

Uploaded by

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

PROGRAMS USING FUNCTION

1. Write a function lst_sort(Arr,n) in Python, that accepts a list Arr of


string elements and the number of strings n as its arguments and
sort the strings in descending order using bubble sort
technique.
2. Write a function fn(A,n) in Python, that accepts a tuple A of integer
elements and the number of elements n as its arguments and
print the prime palindrome numbers.
3. Write a user defined function words(S) in Python, that accepts a
string S as arguments and that separately counts and displays the
number of vowels , consonants, digits and special characters in a
string.
4. Write a function Upper_case(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.
For example, Consider the following dictionary
PLACES={1:"Delhi",2:"London",3:"Paris",4:"New York",5:"Doha"}
The output should be: LONDON NEW YORK
5. Write a function, lenWords(STRING), that takes a string as an
argument and returns a tuple containing length of each word of a
string.
For example, if the string is "Come let us have some fun",
the tuple will have (4,3, 2, 4, 4, 3)

6. Write a function Fibo_Series(n), where n is the number of


Fibonacci terms to be generated is passed as an argument to the
function. Store the term number and actual term of the series as
key:value pair in the dictionary. Display the dictionary
in the function.
Eg: if n is 5, then the dictionary will be:
{1:0,2:1,3:1,4:2,5:3}

You might also like