Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

using python 3: actress = ( (\"Julia\", \"Roberts\"), (8, \"October\", 1967), [

ID: 3877955 • Letter: U

Question

using python 3:

actress = ( ("Julia", "Roberts"), (8, "October", 1967),
[ ("Duplicity", 2009),
("Notting Hill", 1999),
("Pretty Woman", 1990),
("Erin Brockovich", 2000),
("Eat Pray Love", 2010),
("Mona Lisa Smile", 2003) ],
("Atlanta", "Georgia") )

print(type(actress[1]))
print(actress[1])
for movies in actress: this is line 12
print(actress[2:])

On new line (the body of the loop), display only the title of the movie. Run.

On line 12, append the movie (“Oceans Twelve”, 2004) to the list. Run and notice that, even though the tuple is immutable, we can change its list which is mutable.

Explanation / Answer

Firstly we have to append the tuple (“Oceans Twelve”, 2004) in list actress[2].

Then, We have to print the names of all the movies present in the list actress[2].

Python3 code:

actress = ( ("Julia", "Roberts"), (8, "October", 1967),[ ("Duplicity", 2009),("Notting Hill", 1999),("Pretty Woman",1990),("Erin Brockovich", 2000),("Eat Pray Love", 2010),("Mona Lisa Smile", 2003) ],("Atlanta", "Georgia") )
actress[2].append(("Oceans Twelve", 2004))
for movie in actress[2]:
print(movie[0])

Sample Output:

Duplicity
Notting Hill
Pretty Woman
Erin Brockovich
Eat Pray Love
Mona Lisa Smile
Oceans Twelve