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

vertopal.com_02 - Python Strings - Execrise

The document provides assignment instructions for students, encouraging them to attempt all questions and seek help during mentoring sessions. It includes a detailed exercise involving string manipulation and analysis of a text about the history of SMS technology. The exercise covers various tasks such as counting characters and words, extracting and modifying text, and converting strings, with specific coding prompts for each question.

Uploaded by

bragha144
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)
9 views

vertopal.com_02 - Python Strings - Execrise

The document provides assignment instructions for students, encouraging them to attempt all questions and seek help during mentoring sessions. It includes a detailed exercise involving string manipulation and analysis of a text about the history of SMS technology. The exercise covers various tasks such as counting characters and words, extracting and modifying text, and converting strings, with specific coding prompts for each question.

Uploaded by

bragha144
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/ 7

Assignment Instructions

Hello Innominion,

• Try to attempt all the questions in every possible way.

• Some other topics are required to solve some questions. don't panic.

• Those questions can be answered after the topics are taught.

• Join Mentoring Session for the Support/Doubts Resolving with Our


Technical Mentors (2.00 PM - 6.00 PM Mon-Sat)

Happy Learning !!!

Strings - Execrise
text = """The University of Hawaii began using radio to send digital
information as early as 1971,using ALOHAnet.
Friedhelm Hillebrand conceptualised SMS in 1984 while working for
Deutsche Telekom. Sitting at a typewriter at home,
Hillebrand typed out random sentences and counted every letter,
number, punctuation, and space.
Almost every time, the messages contained fewer than 160 characters,
thus giving the basis for the
limit one could type via text messaging. With Bernard Ghillebaert of
France Télécom, he developed
a proposal for the GSM (Groupe Spécial Mobile) meeting in February
1985 in Oslo.
The first technical solution evolved in a GSM subgroup under the
leadership of Finn Trosby.
It was further developed under the leadership of Kevin Holley and Ian
Harris (see Short Message Service).
SMS forms an integral part of SS7 (Signalling System No. 7). Under
SS7, it is a "state" with a 160 character data,
coded in the ITU-T "T.56" text format, that has a "sequence lead in"
to determine different language codes,
and may have special character codes that permits, for example,
sending simple graphs as text.
This was part of ISDN (Integrated Services Digital Network) and since
GSM is based on this,
made its way to the mobile phone. Messages could be sent and received
on ISDN phones,
and these can send SMS to any GSM phone. The possibility of doing
something is one thing,
implementing it another, but systems existed from 1988 that sent SMS
messages to mobile phones (compare ND-NOTIS)."""

Question: How many characters in text

# CODE HERE

1507

Question: How many words are there in the "text"

# CODE HERE

244

Question: How many unique words in the "text"

# CODE HERE

174

Question: Find Lexical diversity

lexical_diversity = (number of words)/(number of unique words)

1.4022988505747127

Question: Count how many "the" in text

# CODE HERE

14

Question: Count how many "a" in text

92

Question: Extract First 10 words in text


# CODE HERE

'The University of Hawaii began using radio to send digital'

Question: Append " Innomatics Reseach Labs" after first 10 words in the text

# CODE HERE

'The University of Hawaii began using radio to send digital Innomatics


Reseach Labs'

Question: Extract First Fourteen (14) character in text

# CODE HERE

'The University'

Question: Extract first Fourteen (14) words in text

# CODE HERE

'The University of Hawaii began using radio to send digital


information as early as'

Question: Extract First 10 words in text


• Convert every letter into upper case
• Convert every letter into lower case
# CODE HERE

'THE UNIVERSITY OF HAWAII BEGAN USING RADIO TO SEND DIGITAL'

# CODE HERE

'the university of hawaii began using radio to send digital'

Question: Find the list of letter starting with


• u

• o
hint - You need to use for loop for this

# CODE HERE

List of words staring with u is:


{'using', 'university', 'under'}

List of words staring with o is:


{'out', 'of', 'one', 'on', 'oslo.'}

Question: Find the list of letter ending with


• e

• n
hint - You need to use for loop for this

# CODE HERE

List of words ends with e is:


{'be', 'these', 'deutsche', 'one', 'made', 'he', 'message', 'type',
'mobile', '(compare', 'france', 'determine', '(see', 'have',
'(groupe', 'while', 'since', '"sequence', 'simple', 'language', 'the'}

List of words ends with n is:


{'kevin', 'than', 'in', 'ian', 'an', 'solution', 'finn', 'on', 'can',
'information', 'isdn', 'began'}

Question: Extract first 10 words of text and Capitalize first letter of each word

# CODE HERE

'The University Of Hawaii Began Using Radio To Send Digital'

Question: Replace the word "University" with name "Innomatics" in text

# CODE HERE
The Innomatics of Hawaii began using radio to send digital information
as early as 1971,using ALOHAnet.
Friedhelm Hillebrand conceptualised SMS in 1984 while working for
Deutsche Telekom. Sitting at a typewriter at home,
Hillebrand typed out random sentences and counted every letter,
number, punctuation, and space.
Almost every time, the messages contained fewer than 160 characters,
thus giving the basis for the
limit one could type via text messaging. With Bernard Ghillebaert of
France Télécom, he developed
a proposal for the GSM (Groupe Spécial Mobile) meeting in February
1985 in Oslo.
The first technical solution evolved in a GSM subgroup under the
leadership of Finn Trosby.
It was further developed under the leadership of Kevin Holley and Ian
Harris (see Short Message Service).
SMS forms an integral part of SS7 (Signalling System No. 7). Under
SS7, it is a "state" with a 160 character data,
coded in the ITU-T "T.56" text format, that has a "sequence lead in"
to determine different language codes,
and may have special character codes that permits, for example,
sending simple graphs as text.
This was part of ISDN (Integrated Services Digital Network) and since
GSM is based on this,
made its way to the mobile phone. Messages could be sent and received
on ISDN phones,
and these can send SMS to any GSM phone. The possibility of doing
something is one thing,
implementing it another, but systems existed from 1988 that sent SMS
messages to mobile phones (compare ND-NOTIS).

Question: Convert the "text" into sentances and store those into one variable called
"sentance"

# CODE HERE

['The University of Hawaii began using radio to send digital


information as early as 1971,using ALOHAnet',
' \nFriedhelm Hillebrand conceptualised SMS in 1984 while working for
Deutsche Telekom',
' Sitting at a typewriter at home, \nHillebrand typed out random
sentences and counted every letter, number, punctuation, and space',
' \nAlmost every time, the messages contained fewer than 160
characters, thus giving the basis for the \nlimit one could type via
text messaging',
' With Bernard Ghillebaert of France Télécom, he developed \na
proposal for the GSM (Groupe Spécial Mobile) meeting in February 1985
in Oslo',
' \nThe first technical solution evolved in a GSM subgroup under the
leadership of Finn Trosby',
' \nIt was further developed under the leadership of Kevin Holley and
Ian Harris (see Short Message Service)',
' \nSMS forms an integral part of SS7 (Signalling System No',
' 7)',
' Under SS7, it is a "state" with a 160 character data, \ncoded in
the ITU-T "T',
'56" text format, that has a "sequence lead in" to determine
different language codes, \nand may have special character codes that
permits, for example, sending simple graphs as text',
' \nThis was part of ISDN (Integrated Services Digital Network) and
since GSM is based on this, \nmade its way to the mobile phone',
' Messages could be sent and received on ISDN phones, \nand these can
send SMS to any GSM phone',
' The possibility of doing something is one thing, \nimplementing it
another, but systems existed from 1988 that sent SMS messages to
mobile phones (compare ND-NOTIS)',
'']

Question:

1.From the above sentance remove '\n'

1. From the above sentace print the first word from each sentance

1. From the above sentace print even posioned sentances

Question: If the following string is given as input to the program:


• H1e2l3l4o5w6o7r8l9d
Output: Then, the output of the program should be:
• Helloworld
# CODE HERE

Helloworld

Innomatics Research Labs


www.innomatics.in

You might also like