80.6k views
23 votes
User inserts 10 numbers. Write a program that will show if there are more positive or negative numbers among the entered numbers.

User Crystina
by
4.0k points

1 Answer

7 votes

Here is a basic program that I wrote. This will check how many positive/negative numbers are in the table and then prints the amount..

Using Python

# list of numbers

list1 = [10, -21, 4, -45, 66, -93, 1]

pos_count, neg_count = 0, 0

# iterating each number in list

for num in list1:

# checking condition

if num >= 0:

pos_count += 1

else:

neg_count += 1

print("Positive numbers: ", pos_count)

print("Negative numbers: ", neg_count)

User Ngoctranfire
by
4.8k points