Home /
Expert Answers /
Computer Science /
use-a-list-comprehension-in-one-line-of-code-create-a-list-of-all-the-integers-in-range-10-but-pa339
(Solved):
Use a list comprehension in one line of code, create a list of all the integers in range(10), but ...
Use a list comprehension in one line of code, create a list of all the integers in range(10), but with the following two requirements: 1. replace all even numbers by the string "Even". 2. exclude any original numbers divisible by 3 . Your code should return: [1, 'Even', 'Even', 5, 7, 'Even'] Hint: you can use conditionals on both the iterator and the values. Question 2 5 pts Given a list of strings: my_str \( = \) ['one', 'two', 'three', 'four', 'five' \( ] \), use and to print out all strings which are longer than 3 letters. Hint: You should use function and Your code should return: Write your one line code here: