🔍
Is the following piece of code valid?  >>> a=(1,2,3)  >>> b=('A','B','C')  >>> c=zip(a,b)  a) Yes, c will be ((1,2,3),(‘A’,’B’,’C’))  b) Yes, c will be ((1,2,3),(‘A’,’B’,’C’))  c) No because tuples are immutable  d) No because the syntax for zip function isn’t valid
0 like 0 dislike

Related questions

Is the following piece of code valid? >>> a=(1,2,3,4) >>> del a a) No because tuple is immutable b) Yes, first element in the tuple is deleted c) Yes, the entire tuple is deleted
Answer : c) Yes, the entire tuple is deleted...

View solution
0 like 0 dislike
1 answer

What is the output of the following piece of code when executed in Python shell? >>> a=("Check")*3 >>> a a) (‘Check’,’Check’,’Check’) b) * Operator not valid for tuples c) (‘CheckCheckCheck’) d) Syntax erro
Answer : c) (‘CheckCheckCheck’)...

View solution
0 like 0 dislike
1 answer

What is the output of the following piece of code? >>> a=(0,1,2,3,4) >>> b=slice(0,2) >>> a[b] a) Invalid syntax for slicing b) [0,2]. c) (0,1) d) (0,2)
Answer : c) (0,1)...

View solution
0 like 0 dislike
1 answer

What is the output of the following code? >>> a=(1,2,3,4) >>> del(a[2]) a) Now, a=(1,2,4) b) Now, a=(1,3,4) c) Now a=(3,4) d) Error as tuple is immutable
Answer : d) Error as tuple is immutable...

View solution
0 like 0 dislike
1 answer

50.5k questions

47.1k answers

240 comments

7.0k users