logo CodeStepByStep logo

tuple_errors

Language/Type: Python lists

The following code uses tuples and contains four errors. Which of the following are errors?

# incorrect code that interacts with a tuple
t = (10, 20, 30)
t[0] += 1
if len(t) < 5:
    t.append(40)
    print("t is", t)
    t.reverse()
    print("t is", t)
else:
    t.clear()
errors (check all)
(order shuffled)

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.