Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python program to print negative numbers in a list

# Python program to print negative Numbers in a List
  
# list of numbers
list1 = [-10, 21, -4, -45, -66, 93]
num = 0
  
# using while loop     
while(num < len(list1)):
      
    # checking condition
    if list1[num] < 0:
        print(list1[num], end = " ")
      
    # increment num 
    num += 1
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Python #program #print #negative #numbers #list
ADD COMMENT
Topic
Name
3+6 =