Print
Category: If
Hits: 424

If03. Given an integer. If it is positive, then add 1; If negative, subtract 2 from it; If zero, then replace it by 10. Output the resulting number.

Solution in Python 3:

import random

A = random.randrange(-3,3)
print("Number:", A)

if A > 0:
A += 1
elif A < 0:
A -=2
else:
A = 10

print(A)