Examveda

What will be the output of the following Python 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: Option C


This Question Belongs to Python Program >> Tuples In Python

Join The Discussion

Related Questions on Tuples in Python