Course Home | Class Schedule | Moodle CMS | Git Submission | Perusall | Tutoring

Saint Louis University

Computer Science 1300
Introduction to Object-Oriented Programming

Michael Goldwasser

Spring 2020

Computer Science Department

Homework Assignment 25b

Ensure that you adhere to the policies on academic integrity.


  1. (Oops. Same problem as last homework).

    Using the illustration style of the chapter, draw a diagram of the final configuration that results after executing the following program:

    c = [0, 1, 2]
    d = c
    c.append(7)
    e = list(d)
    e.append(8)
    
  2. Assume that someone uses the identifier myHouse as a reference to an object representing the actual house in which they live, and similarly yourHouse for another person's house. For example, one such scenario might be portrayed as follows.

Using the real-world analogy of houses, explain the semantics that would be expressed by each of the following Python expressions. Do not answer the question specifically for the above scenario. Instead give an explanation of the general semantics of each Python expression in terms of what it tests or what action it causes.

  1. myHouse is yourHouse
  2. myHouse == yourHouse
  3. myHouse = yourHouse
  4. myHouse = copy(yourHouse)
  5. myHouse = deepcopy(yourHouse)
  6. In English, the colloquial phrase "my house is your house" is used to welcome a guest into a host's home, suggesting that they share the house as it it were their own possession. None of the above Python expressions properly captures the spirit of this original phrase. Give a Python syntax that more accurately portrays such semantics.

Michael Goldwasser
CSCI 1300, Spring 2020
Last modified: Sunday, 29 December 2019
Course Home | Class Schedule | Moodle CMS | Git Submission | Perusall | Tutoring