Sunday, May 26, 2024

📑 List Methods and Generators

📑 Task

1) What values do the generators calculate in this case?
What will the program print?
2) Give a similar example using generators and list methods,
where it is impossible to use lists with completely different values

📑 Answer

1) The outputs: [21, 'a', 21] and [2, 1, 1, 0, 0, 1, 2, 2, 1]
Both generators calculate their values in the first list
based on information from the second one
2)

No comments:

Post a Comment