Q. If a is [1, 2, 3]
(a)what is the difference (if any) between a * 3 and [a, a, a]?
(b) is a * 3 equivalent to a + a + a?
(c) what is the meaning of a[1 : 1 ] = 9?
(d) what's the difference between a[1:2] 4 and a[1:1]
You can understand by Watching video :-
Answer =
a =
a * 3 means that it have 3 time of value a in one list, while [a, a, a] is form nested list.
b =
Yes
c =
a[1:1] = 9
first of all it give error it mean that we are trying to assign a non sequence value to the list slice, such as number.
d =
a[1:2 ] = 4 it means that value 4 put at index number 1, but in a [1:1 ] = 4 it means that there is no index number where that value can be put in the list, but both will give error because they are non sequnce value.
shut up
ReplyDeletei dont like u
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )