0% found this document useful (0 votes)
40 views5 pages

Dictionaries

The document discusses functions, strings, lists, and dictionaries in Python. It provides examples of tasks involving finding maximum/minimum values, factorials, Fibonacci sequences, prime numbers, string slicing, word counts, file reading, word lists, categorizing data, and building histograms.

Uploaded by

Swapnapriya
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)
40 views5 pages

Dictionaries

The document discusses functions, strings, lists, and dictionaries in Python. It provides examples of tasks involving finding maximum/minimum values, factorials, Fibonacci sequences, prime numbers, string slicing, word counts, file reading, word lists, categorizing data, and building histograms.

Uploaded by

Swapnapriya
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
You are on page 1/ 5

FUNCTIONS

1) Find the biggest of three numbers using fruitful function.

2) Find the factorial of a given number by iterative method using fruitful functions.

3) sGenerate a fibanocci series by iterative method using function.


4)Find the prime number within the specified range using functions.

SRINGS
4) Take a Python code that takes the string:"X-DSPAM-Confidence:0.8475".Use find and string slicing to
extract the portion of the string after the colon character and then use the float function to convert the
extracted string into a floating point number.
5) Calculate the average word length of a any given input string.

LISTS
6) Write a program to open a file and read it line by line. For each line, split the line into a list of words using
the split function. For each word, check to see if the word is already ther e in a list.If the word is not in the
list, add to the list.
DICTIONARIES

7) Write a program that categorizes each mail message by which day of the week the commit was done. To do
this look for lines that start with “From”, then look for the third word and keep a running count of each of
the days of the week. At the end of the program print out the contents of your dictionary.

Output :

8) Write a program to read through a mail log, build a histogram using a dictionary to count how many
messages have come from each email address and print dictionary.

Output:
9) To print most common words in the text

Output:

You might also like