Lab 1.02 - Using the Interpreter

Part 1

Using the interpreter, type in the expressions below. Copy and paste the output into the output column. If the result is unexpected, note that in the third column.

Section 1

Input     Output     Did it do something unexpected?
a 5 + 2 * 2
b 2/3
c 2.0 * 1.5
d (2 + 3) * 10
e 5.0 // 2
f 5.0 % 2

Section 2

Input     Output     Did it do something unexpected?
a a
b 'a'

Section 3

Input     Output     Did it do something unexpected?
a 'a + b'
b 'a' + 'b'

Section 4

Input     Output     Did it do something unexpected?
a 'a' * 'b'
b 'a' * 2

Part 2

Before going to the IDE:

  1. For each item, predict the data type of the result and enter into the "String/Integer/Float" column.
  2. Next, predict the value of the result for each item and enter into it into the "Prediction of Result" column.
Expression String/Integer/Float Prediction of Result Interpreter Result
10 * 2 integer 20 20
.5 * 2
10/2
10%2
2 ** 3
(2+5)*3
2 + 5 * 3
'ab' + '12' + '3'
x
"ab" + "cd"
'abc' * 2
'1'*2 + '2' * 3
1 * 2 + '3' * 2
'A' ** 2
'bc' % 2
'bc' / 2

Now go to the IDE:

  1. Use the interpreter to evaluate the expressions, write down results in the "Interpreter Result" column.