filmov
tv
TY Python - replace an element in a list

Показать описание
2nd video in how to teach yourself to manipulate lists in Python. Here teach ourselves to add / insert a word (homework from previous video) and how to replace a word. Previous video link
teach yourself tasks:
1 - put this into python as a string.
2 - turn each word into an element in the string
3 - change "rom" amd "romeo" as you want AND / OR change anything else
4 - go onto "gutenburg", get some of the text of a book / play, and do the same thing
Romeo / Juliet...................
Rom. By the hour of nine.
Jul. I will not fail. 'Tis twenty years till then.
I have forgot why I did call thee back.
Rom. Let me stand here till thou remember it.
Jul. I shall forget, to have thee still stand there,
Rememb'ring how I love thy company.
Rom. And I'll still stay, to have thee still forget,
Forgetting any other home but this.
Jul. 'Tis almost morning. I would have thee gone-
And yet no farther than a wanton's bird,
That lets it hop a little from her hand,
Like a poor prisoner in his twisted gyves,
And with a silk thread plucks it back again,
So loving-jealous of his liberty.
Rom. I would I were thy bird.
Jul. Sweet, so would I.
Yet I should kill thee with much cherishing.
Good night, good night! Parting is such sweet sorrow,
That I shall say good night till it be morrow.
[Exit.]
Rom. Sleep dwell upon thine eyes, peace in thy breast!
Would I were sleep and peace, so sweet to rest!
Hence will I to my ghostly father's cell,
His help to crave and my dear hap to tell.
Exit
teach yourself tasks:
1 - put this into python as a string.
2 - turn each word into an element in the string
3 - change "rom" amd "romeo" as you want AND / OR change anything else
4 - go onto "gutenburg", get some of the text of a book / play, and do the same thing
Romeo / Juliet...................
Rom. By the hour of nine.
Jul. I will not fail. 'Tis twenty years till then.
I have forgot why I did call thee back.
Rom. Let me stand here till thou remember it.
Jul. I shall forget, to have thee still stand there,
Rememb'ring how I love thy company.
Rom. And I'll still stay, to have thee still forget,
Forgetting any other home but this.
Jul. 'Tis almost morning. I would have thee gone-
And yet no farther than a wanton's bird,
That lets it hop a little from her hand,
Like a poor prisoner in his twisted gyves,
And with a silk thread plucks it back again,
So loving-jealous of his liberty.
Rom. I would I were thy bird.
Jul. Sweet, so would I.
Yet I should kill thee with much cherishing.
Good night, good night! Parting is such sweet sorrow,
That I shall say good night till it be morrow.
[Exit.]
Rom. Sleep dwell upon thine eyes, peace in thy breast!
Would I were sleep and peace, so sweet to rest!
Hence will I to my ghostly father's cell,
His help to crave and my dear hap to tell.
Exit
Комментарии