If05. Three integers are given. Find the number of positive and the number of negative numbers in the source set.

Solution in Python 3:

import random

A = random.randrange(-3,3)
B = random.randrange(-3,3)
C = random.randrange(-3,3)
print("Three numbers:", A, B, C)

x = 0
if A > 0:
x += 1
if B > 0:
x += 1
if C > 0:
x += 1
print("Number of positive numbers: ", x)

y = 0
if A < 0:
y += 1
if B < 0:
y += 1
if C < 0:
y += 1
print("Number of negative numbers: ", y)