CBSE Class 11 Computer Science Question 20 of 34

Tuples — Question 25

Back to all questions
25
Question

Question 3(i)

Carefully read the given code fragments and figure out the errors that the code may produce.

t = ( 'a', 'b', 'c', 'd', 'e') 
1n, 2n, 3n, 4n, 5n = t
Answer
Output
SyntaxError: invalid decimal literal 
Explanation

This error occurs when we declare a variable with a name that starts with a digit. Here, t is a tuple containing 5 values and then we are performing unpacking operation of tuples by assigning tuple values to 1n,2n,3n,4n,5n which is not possible since variable names cannot start with numbers.

Get the Bright Tutorials app Stuck on a question? Ask Bright Buddy — your AI tutor — for step-by-step help in the app.