Chapters
Python114 chapters

Exercises

Variable Names

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

Exercise 1

Rename the variables to snake_case so the code follows the usual Python convention.

Python
FirstName = "Grace"
itemsInCart = 3
print(FirstName, itemsInCart)
Exercise 2

This shadows the builtin list, so the last line fails. Rename the variable and keep the output.

Python
list = [3, 1, 2]
print(sorted(list))
print(list((1, 2)))
Exercise 3

Print how many reserved words Python has.

Python
# import keyword and print how many there are