Q&A Discussões
{ 1, 2, 3, 4 {1, 5, 6, 7}, 5, 6, 3, 4} For the question: What is the output of this code? sqs = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] print(sqs[1::4]), 1. What will be the output?
1.
>>> m = [[x, x + 1 , x + 2] for x in ran
a) [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
b) [[0, 1, 2], [1, 2, 3], [2, 3, 4]]
c) [1, 2, 3, 4, 5, 6, 7, 8, 9]
d) [0, 1, 2, 1, 2, 3, 2, 3, 4] mylist = [0, 1, 2, 3, 4, 5, 6, 7] for i in mylist: mylist.remove(i) print(myList)
output is
[1, 3, 5, 7]
Why not removing all squares = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
print(squares[2:6]) how does it result in [4, 9, 16, 25] I don't und2 why the answer of this code is [0, 1, 4, 9, 16, 25, 36, 49, 64] and not [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] and iam remember that -1 starts from the last no. in the list , then why the answer is not include 81????