Series14. An integer K and a set of non-zero integers are given; The sign of its completion is the number 0. Output the number of numbers in the set smaller than K.

Solution in Python 3:

import random

K = random.randrange(-3,5)
print("K = ",K)

x = random.randrange(1,10)
print(x,end='; ')
k = 0
if x < K:
k += 1
while x != 0:
if x < K:
k += 1
x = random.randrange(-5,6)
print(x,end='; ')

print()
print("Amount of numbers less than K:",k)