LearnPy Hub
← Comprehensions problems
Easy

Keep the Positives

Read integers and print a list of only the positive ones using a comprehension with if.

Input

Integers separated by spaces.

Output

A Python list.

Sample 1

Input
3 -1 0 5
Output
[3, 5]

Sample 2

Input
-1 -2
Output
[]
solution.py
Output appears here
Keep the Positives · Python practice problem · LearnPy Hub