Colab

"the quick brown fox jumped over the lazy dog".split()

['the', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy', 'dog']
"name, age, country".split(',')

['name', 'age', 'country']
greeneggs = """\
Do you like
Green eggs and ham
I do not like them
Sam-I-am
I do not like
Green eggs and ham
Would you like them
Here or there?
I would not like them
Here or there
I would not like them
Anywhere
I do not like
Green eggs and ham
I do not like them
Sam-I-am
"""
greeneggs.splitlines()

['Do you like',
 'Green eggs and ham',
 'I do not like them',
 'Sam-I-am',
 'I do not like',
 'Green eggs and ham',
 'Would you like them',
 'Here or there?',
 'I would not like them',
 'Here or there',
 'I would not like them',
 'Anywhere',
 'I do not like',
 'Green eggs and ham',
 'I do not like them',
 'Sam-I-am']
words = "the quick brown fox jumped over the lazy dog".split()
" ".join(words)

'the quick brown fox jumped over the lazy dog'
fields = "name, age, country".split(',')
", ".join(fields)

'name,  age,  country'
greeneggs[0]

'D'
greeneggs[20]

'g'
greeneggs[0:22]

'Do you like\nGreen eggs'
greeneggs[:22]

'Do you like\nGreen eggs'
x = greeneggs[22:len(greeneggs) -1]
print(x)

 and ham
I do not like them
Sam-I-am
I do not like
Green eggs and ham
Would you like them
Here or there?
I would not like them
Here or there
I would not like them
Anywhere
I do not like
Green eggs and ham
I do not like them
Sam-I-am
x = greeneggs[22: -1]
print(x)

 and ham
I do not like them
Sam-I-am
I do not like
Green eggs and ham
Would you like them
Here or there?
I would not like them
Here or there
I would not like them
Anywhere
I do not like
Green eggs and ham
I do not like them
Sam-I-am
x = greeneggs[22: ]
print(x)

 and ham
I do not like them
Sam-I-am
I do not like
Green eggs and ham
Would you like them
Here or there?
I would not like them
Here or there
I would not like them
Anywhere
I do not like
Green eggs and ham
I do not like them
Sam-I-am

x = greeneggs[: ]
print(x)

Do you like
Green eggs and ham
I do not like them
Sam-I-am
I do not like
Green eggs and ham
Would you like them
Here or there?
I would not like them
Here or there
I would not like them
Anywhere
I do not like
Green eggs and ham
I do not like them
Sam-I-am

x = greeneggs[22:30 ]
print(x)

 and ham
x = greeneggs[22:30:2 ]
print(x)

 n a
x = greeneggs[22:30:1 ]
print(x)

 and ham
x = greeneggs[::2 ]
print(x)

D o ieGeneg n a
 ontlk hmSmIa
 ontlk
re gsadhmWudyulk hmHr rtee
 ol o iete
eeo hr
 ol o iete
nweeId o ieGeneg n a
 ontlk hmSmIa

x = greeneggs[::-1]
print(x)


ma-I-maS
meht ekil ton od I
mah dna sgge neerG
ekil ton od I
erehwynA
meht ekil ton dluow I
ereht ro ereH
meht ekil ton dluow I
?ereht ro ereH
meht ekil uoy dluoW
mah dna sgge neerG
ekil ton od I
ma-I-maS
meht ekil ton od I
mah dna sgge neerG
ekil uoy oD