0% found this document useful (0 votes)
14 views

Practical List (Function & Text File) 2024

alal

Uploaded by

skhushbir247
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)
14 views

Practical List (Function & Text File) 2024

alal

Uploaded by

skhushbir247
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

Practical List – FUNCTIONS

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.

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
4

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)
5

TEXT File

6.

9 Write a Python function that displays all the words containing @cmail from a text file "Emails.txt".
10 Write a Python function that finds and displays all the words longer than 5 characters from a text file "Words.txt".

You might also like