345508 (1) [Avatar] Offline
I have a question about the MyTeacher YourTeacher thing.
“>>> MyTeacher = "Mrs. Goodyear"
>>> YourTeacher = MyTeacher
>>> MyTeacher
"Mrs. Goodyear"
>>> YourTeacher
"Mrs. Goodyear”

The question in the cartoon says "If we replaced Mrs. Goodyear with Mrs. Tysick, would YourTeacher change to Mrs. Tysick?"

The book says No, and I do not understand why? Won't it just assign YourTeacher whatever the value of MyTeacher is in the program? I wrote the program and changed the name and every name you change it to is the name YourTeacher is given.

“>>> MyTeacher = "Mrs. Tysick"
>>> YourTeacher = MyTeacher
>>> MyTeacher
"Mrs. Tysick"
>>> YourTeacher
"Mrs. Tysick”

Why does the book say No to that question? I don't understand the whole sticking a label on something else when the word replace was used in the text.

Thanks for any assistance.
433374 (1) [Avatar] Offline
Good question, Carter! But you just change ALL name.
The right example from the book is:

>>> myTeacher = "Mrs. Kate"
>>> yourTeacher = myTeacher
>>> print myTeacher
Mrs. Kate
>>> yourTeacher
'Mrs. Kate'

>>> myTeacher = "Mark"
>>> print yourTeacher
Mrs. Kate
>>> print myTeacher

It's just about logic of this python's language. Need to remember it.