SCPPE20
Assignment 1
SEMESTER 1
ANSWERS 2026
SCPPE20 Assignment 1
SEMESTER 1 ANSWERS 2026
, SCPPE20 Assignment 1: Loops and Conditionals
Question 1: Number Classification
```python
# Q1 - Number Classification
positive = 0
negative = 0
zero = 0
while True:
try:
x = int(input("Enter a number (-1 to quit): "))
except ValueError:
print("Invalid input. Please enter an integer.")
continue
if x == -1:
break
if x > 0:
print("Positive")
positive += 1
elif x < 0:
print("Negative")
negative += 1
else:
print("Zero")
zero += 1
Assignment 1
SEMESTER 1
ANSWERS 2026
SCPPE20 Assignment 1
SEMESTER 1 ANSWERS 2026
, SCPPE20 Assignment 1: Loops and Conditionals
Question 1: Number Classification
```python
# Q1 - Number Classification
positive = 0
negative = 0
zero = 0
while True:
try:
x = int(input("Enter a number (-1 to quit): "))
except ValueError:
print("Invalid input. Please enter an integer.")
continue
if x == -1:
break
if x > 0:
print("Positive")
positive += 1
elif x < 0:
print("Negative")
negative += 1
else:
print("Zero")
zero += 1