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

TIU Assignment-7

Uploaded by

archiearya7079
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)
18 views1 page

TIU Assignment-7

Uploaded by

archiearya7079
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/ 1

Techno India University

Python Training Session Assignment

1) Write a Python function that takes a string sentence as input and returns a
dictionary where keys are unique words in the sentence and values are the
frequencies of those words. Ignore case sensitivity and punctuation.

Input:
Str = “Hello world! Hello universe”

Output:
{'hello': 2, 'world': 1, 'universe': 1}

2) Write a python function that takes a list of strings words and groups them into lists
of anagrams. Anagrams are words that contain the same letters but in a different
order.

Input:

words= ["eat", "tea", "tan", "ate", "nat", "bat"]

Output:
[['eat', 'tea', 'ate'], ['tan', 'nat'], ['bat']]

3) Write a python function that takes a string S and returns the length of the longest
substring without repeating characters.

Input 1:
S = "abcabcbb"

Output 1:
3 ("abc" or "bca")

Input 2:
S = " pwwkew"

Output 2:
3 ("wke")

TIU Internal

You might also like