Chapters
Python114 chapters

Exercises

Data Types

3 tasks. Write the code, press Check, and the page runs it against a real Python interpreter.

Exercise 1

Print the type of each of the four values, one per line.

Python
values = [42, 3.14, "hello", True]
# print the type of each
Exercise 2

result is None. Print True only if it really is None, using the right test.

Python
result = None
# print whether result is None
Exercise 3

Show that a string cannot be changed in place: print the uppercase version, then print the original unchanged.

Python
text = "abc"
# print the uppercase version, then the original