CBSE Class 11 Computer Science Question 61 of 88

Tuples and Dictionary — Question 26

Back to all questions
26
Question

Question 14(c)

Consider the following code and find out the error:

tup1 = ("Riya", ) * '4'
Answer

The code will result in an Error because the multiplication operator * is being used incorrectly between a tuple and a string. The multiplication operator * in Python is used to repeat the elements of a tuple a certain number of times, but the number of repetitions must be an integer, not a string.