Starting from:

$24.99

IT5001 Lab 1 -Evaluation, Variables and Turtle Solution


In this exercise, try to come up with the answer without using IDLE/Python first. Then type the expressions into IDLE to verify your answers. The objective is for you to understand why and how they work.
Part 1 Arithmetic Evaluation
Code Output

3 * 4 + 5


3 + 4 * 5


5 ** 3 % 4


97 / 4


97 // 4

Part 2 Logical Evaluation
Code Output

3 + 2 == 1 + 4


4 > 4


True or False


not False


not not True


not 0


not 9999


Part 3 String Evaluation
Code Output

'abc' + 'def'


'gala' * 3


'mu' + 'ha' * 4


('ba '*2+'bidu'*2+'bi ' + 'jam '*2)*3


'banana'[3]


'banana'[2:4]

Part 4 Operator Precedence
Code Output

1 + 2 * 3


1 + 2 * 3 **4


1 + 2 * 3 **4 – 5


not 0 + 1


Part 5 Turtle Graphics
You can draw pictures with the turtle package in Python. Try out the following commands and guess what they will do.

More products