Assessment: Assignment statements in Python

Oct 1, 2014 • Mariela Perignon
  1. Consider the following python script:
    a = 3
    c = 1
    b = 2
    c = a
    a = a + 1
    b = 5
    d = 3*c + a + b
    print d

Which of the following matches the output?
(a) d = 8
(b) d = 18
(c) d = 21
(d) d = 17

  1. What is the output of this script? (make sure each character can be read clearly)
    phrase = ‘the brown dog’
    print ‘[’ + phrase[2:-3] + ‘]’