0

23.(i) What is the output of the following code snippet? a = [ 'Region',[1,2,3,4]] print(a[0][2],end=' ') print(a[1][3])

Python programming

13th Aug 2021, 12:15 AM
Krishnapriya
Krishnapriya - avatar
4 Respuestas
+ 2
Run it in the code playground to find out.
13th Aug 2021, 12:21 AM
Simon Sauter
Simon Sauter - avatar
+ 1
😁
13th Aug 2021, 1:09 AM
Shadoff
Shadoff - avatar
+ 1
a = [ 'Region', [ 1, 2, 3, 4 ] ] a[ 0 ] = 'Region' It's a string of 6 characters a[ 0 ] [ 2 ] = 'g' + Remember index begins at zero a[ 1 ] = [ 1, 2, 3, 4 ] It's a list of 4 integers a[ 1 ][ 3 ] = 4 + Remember index begins at zero Next time ask for explanation, not "what is the output". You can simply run the snippet anywhere to see the output. P.S. And please use the tags to specify a language relevant to your question. https://code.sololearn.com/W3uiji9X28C1/?ref=app
13th Aug 2021, 1:09 AM
Ipang
+ 1
Okay guys
13th Aug 2021, 1:42 AM
Krishnapriya
Krishnapriya - avatar