Exercises for week 2
Ex2a1 Explore division
- Use division (not the truncating division) to divide some values. Use floating point literals and integer literals. Can you find a case where division behaves “odd” compared to a normal calculator?
Ex2a2 Binding names
- Bind the name
x
to a literal with value 42. Bind the namey
to the square ofx
. Make sure, that both values are correct.
Ex2a3 The Life of a Variable
- Type this code at the REPL and note what happens. Is the result what you expected?
>>> x = 7 >>> y = 12 >>> z = x * y >>> z = 10 >>> z
Ex2a3 Using text
- Can you figure out how to print text in the REPL?
Back to the 02_ready | Next chapter |