Exercises

Author

Clayton Cafiero

Published

2025-01-05

Exercises

Exercise 01

Write a line of Python code that prints your name to the console.

Exercise 02

Multiple choice: Python is a(n) ________ programming language.

  1. compiled
  2. assembly
  3. interpreted
  4. binary

Exercise 03

True or false? Code that you write in the Python shell is saved.

Exercise 04

How do you exit the Python shell?

Exercise 05

Python can operate in two different modes. What are these modes and how do they differ?

Exercise 06

The following is an example of what kind of code?

1001011011011011 1110010110110001 1010101010101111 
1111000011110010 0000101101101011 0110111000110110

Exercise 07

Calculate the following sums in binary:

  1. 10 + 1
  2. 100 + 11
  3. 11 + 11
  4. 1011 + 10

After you’ve worked these out in binary, convert to decimal form and check your arithmetic.

Exercise 08 (challenge!)

Try binary subtraction. What is 11011 - 1110? After calculating in binary, convert to decimal and check your answer.