ΣνΜDr. Sharon's Math PlatformSyvara Learning
Question Bank › 📘 Undergraduate › Programming for Engineers › Q3

Q3 · Create a list my_list = [1, 2, 3] and a tuple my_tuple = (1, 2, 3).

Variables, Data Types, and Strings 🟡 Intermediate Coding
Question

Create a list my_list = [1, 2, 3] and a tuple my_tuple = (1, 2, 3).

(a) Change the element at index 2 of my_list to 99. Print the result.
(b) Try to change the element at index 2 of my_tuple to 99. What happens?
(c) Explain the difference between mutable and immutable data types, and when you would use a tuple instead of a list.

🔒

Log in to see the worked solution

Enter your email to get started. Your first free solutions in every course unlock as soon as you verify.

Log in or sign up with email
← Previous Next →
Working…