%%html
<style>
.jp-Notebook{
background-color: #1c0221;
color: yellow;
}
h1{
color: red;
font-family: "Polsku", monospace;
font-weight: bold;
font-size: 54pt !important;
}
h2, h3, h4, h5, h6{
color: white;
}
.jp-Editor pre{
/* input area */
background-color: aliceblue !important;
color: purple !important;
}
.jp-OutputArea-output pre{
/* output area */
color: yellow !important;
}
@font-face{
font-family: "Polsku";
src: url(https://vvvvvvaria.org/~mb/fonts/Polsku.woff);
}
</style>
sentence = "Surely there must be something that drives publishers to publish."
tokens = sentence.split()
print(tokens)
['Surely', 'there', 'must', 'be', 'something', 'that', 'drives', 'publishers', 'to', 'publish.']
for token in tokens:
clean_token = token.strip('.')
lowercase_token = clean_token.lower()
print(lowercase_token)
surely there must be something that drives publishers to publish
tokenlist = []
for token in tokens:
clean_token = token.strip('.')
lowercase_token = clean_token.lower()
tokenlist.append(lowercase_token)
print(tokenlist)
['surely', 'there', 'must', 'be', 'something', 'that', 'drives', 'publishers', 'to', 'publish']
tokenlist.sort()
print(tokenlist)
['be', 'drives', 'must', 'publish', 'publishers', 'something', 'surely', 'that', 'there', 'to']
len(tokenlist)
10