Given a list of numbers, write a Python program to print all positive numbers in given list.
Input: list1 = [12, -7, 5, 64, -14] Output: 12, 5, 64 Input: list2 = [12, 14, -95, 3] Output: [12, 14, 3]
Example #1: Print all positive numbers from given list using for loop
Iterate each element in the list using for loop and check if number is greater than or equal to 0. If the condition satisfies, then only print the number.
11 0 45 66
Example #2: Using while loop
Example #3: Using list comprehension
Positive numbers in the list: 45 93
Example #4: Using lambda expressions
Positive numbers in the list: 21, 4, 93
- Python program to print all positive numbers in a range
- Python program to count positive and negative numbers in a list
- Python program to print even numbers in a list
- Python program to print odd numbers in a List
- Python program to print negative numbers in a list
- Python | Program to print duplicates from a list of integers
- Python Program to Print Numbers in an Interval
- Python program to print all even numbers in a range
- Python program to print all odd numbers in a range
- Python program to count Even and Odd numbers in a List
- Python program to print all Prime numbers in an Interval
- Python program to print all negative numbers in a range
- Python | Get positive elements from given list of lists
- Lambda expression in Python to rearrange positive and negative numbers
- Python program to create a list of tuples from given list having number and its cube in each tuple
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.