This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 17 list comprehension problems in python | |
| fruits = ['mango', 'kiwi', 'strawberry', 'guava', 'pineapple', 'mandarin orange'] | |
| numbers = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, 19, 23, 256, -8, -4, -2, 5, -9] | |
| # Example for loop solution to add 1 to each number in the list | |
| numbers_plus_one = [] | |
| for number in numbers: | |
| numbers_plus_one.append(number + 1) |