Colab

Gouda, Edam, Caithness = range(3)


Gouda

0
list(range(3))

[0, 1, 2]
Caithness

2
type(1)

int
type( (1,) )

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

words

['the', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy', 'dog']
words[::-1]

['dog', 'lazy', 'the', 'over', 'jumped', 'fox', 'brown', 'quick', 'the']
words[::-2]

['dog', 'the', 'jumped', 'brown', 'the']
x = list(range(100))

x[::7]

[0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98]
csv = """\
name, age, country
avi cohen, 30, israel
ben hur, 25. united kingdom
can davidovich, 40, georgia
david ben shalem, 60, united states of america
efrat ben dagan levi, 25, united arab emirates
"""

lines = csv.splitlines()

lines

['name, age, country',
 'avi cohen, 30, israel',
 'ben hur, 25. united kingdom',
 'can davidovich, 40, georgia',
 'david ben shalem, 60, united states of america',
 'efrat ben dagan levi, 25, united arab emirates']
header = lines[0:1]
data = lines[1:]

header

['name, age, country']
data

['avi cohen, 30, israel',
 'ben hur, 25. united kingdom',
 'can davidovich, 40, georgia',
 'david ben shalem, 60, united states of america',
 'efrat ben dagan levi, 25, united arab emirates']
header, data = lines[0:1], lines[1:]
print(header)
print(data)

['name, age, country']
['avi cohen, 30, israel', 'ben hur, 25. united kingdom', 'can davidovich, 40, georgia', 'david ben shalem, 60, united states of america', 'efrat ben dagan levi, 25, united arab emirates']