Conditional statement Quiz doubt

  1. Write a program that prints different messages based on whether a number is positive or negative.

The question is asking to write a code that print a message depending upon whether a given number is positive or negative.

Let’s suppose this is the code start line, where i have created a number variable a_number

a_number = -33

Now using what we have learnt in conditional statements you need to print
“the number is negative” (when a_number is negative)
“the number is positive” (when a_number is positive)

Please try to write this code using the hint above

num = int(input("“the number is negative”, (when a_number is negative)"))

num = int(input("“the number is Positive, (when a_number is positive)"))

if num > 0:

print(" the number is negative")

elif num == 0:

print(“Zero”)

else:

print(" the number is Positive")

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.