Skip to content

Commit cddf834

Browse files
committed
positive/negative values
Signed-off-by: Brian342 <migelbrian3@gmail.com>
1 parent cc0de2e commit cddf834

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

if_set1_3.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
# Write a program that prompts the user for two numbers and then computes them using the following rules.
2-
# If the first number is greater than the second one, the second number is subtracted from the first one.
3-
# If the second number is greater than the first one, the first number is divided by the second one.
4-
# Otherwise, the two numbers are added.
5-
num1 = int(input("Enter first number: "))
6-
num2 = int(input("Enter second number: "))
1+
# Write a program to read a value from the keyboard and output the phrase NEGATIVE if the number is negative,
2+
# POSITIVE if the number is positive or ZERO otherwise.
3+
value = int(input("Enter a value from the keyboard: "))
74

8-
if num1 > num2:
9-
print("num1 - num2 = " + str(num1-num2))
10-
elif num1 < num2:
11-
print("num2 // num1 = " + str(num1 / num2))
5+
if value < 0:
6+
print("NEGATIVE")
7+
elif value > 0:
8+
print("POSITIVE")
129
else:
13-
print("Num1 + num2 = " + str(num1 + num2))
10+
print("ZERO")
1411

1512

0 commit comments

Comments
 (0)