Skip to content

Mistakes on day 13 and day 17. #759

@Prosto1423

Description

@Prosto1423

Day 13
2. Flatten the following list of lists of lists to a one dimensional list :

Wrong:
list_of_lists =[[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]]] # too many square brackets

Right:
list_of_lists = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

Output: [1, 2, 3, 4, 5, 6, 7, 8, 9]

Day 17
Original version:

numbers = range(2, 7) # normal call with separate arguments
print(list(numbers)) # [2, 3, 4, 5, 6]
args = [2, 7]
numbers = range(*args) # call with arguments unpacked from a list
print(numbers) # [2, 3, 4, 5,6]

we will recieve this [2, 3, 4, 5, 6]
range(2, 7)

Good version:

numbers = range(2, 7)
print(list(numbers))
args = [2, 7]
numbers = range(*args)
print(list(numbers)) # added list()

Right answers:
[2, 3, 4, 5, 6]
[2, 3, 4, 5, 6]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions