What will be the output of the following code segment?
TyList = [1,2,3,4,5,6,7,8,9,107
fori in range(0,len(myList)}
if %2 == 0:
print(myList[i])
Answers
Answered by
0
Explanation:
>>> [1, 2, 3, 4]
[1, 2, 3, 4]
>>> ["hello", "world"]
["hello", "world"]
>>> [0, 1.5, "hello"]
[0, 1.5, "hello"]
>>> [0, 1.5, "hello"]
[0, 1.5, "hello"]
A List can contain another list as member.
>>> a = [1, 2]
>>> b = [1.5, 2, a]
>>> b
[1.5, 2, [1, 2]]
The built-in function range can be used to create a sequence of consequetive integers.
Similar questions