ubuntu2004
Kernel: Python 3 (system-wide)
Exercise 7.1
Find and print the index of the substring "watch" in the following string.
In [0]:
In [0]:
Exercise 7.2
Convert the following string to lowercase.
In [0]:
In [0]:
Exercise 7.3
The following text, stored in the variable tbw_intro
, contains two sentences.
Find the index of the full stop at the end of the first sentence and store it in a variable called
idx
.Using string slicing with the variable
idx
, assign the first sentence (with full stop) to the variablesentence1
.Again using string slicing and
idx
, assign the second sentence (with full stop) to the variablesentence2
.Print both sentences separately.
In [2]:
In [3]:
Out[3]:
We animals are the most complicated things in the known universe.
The universe that we know, of course, is a tiny fragment of the known universe.