wpton786
Badges: 0
Rep:
?
#1
Report Thread starter 4 years ago
#1
How can I turn an input into a list (in python) and then the words in the sentence are displayed as there position in the list

FOR EXAMPLE:

User inputs a sentence. "Hello my name is bob and I like football".
This is then put into a list.
List("Hello my name is bob and I like football")
The list is then reprinted as [0,1,2,3,4,5,6,7,8,9,10]. Depending on the amount of words in the list.

Can someone please help me.
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

How are you feeling ahead of starting University?

I am excited and looking forward to starting (41)
13.76%
I am excited but have some apprehension around Covid-19 measures (44)
14.77%
I am concerned I will miss out on aspects of the uni experience due to new measures (103)
34.56%
I am concerned the Covid-19 measures at uni are not strong enough (29)
9.73%
I am nervous and feel I don't have enough information (65)
21.81%
Something else (let us know in the thread!) (16)
5.37%

Watched Threads

View All