Answer to Question #228445 in Python for als

Question #228445

Write a python program which takes a number from the user and prints if it is positive, negative or 0, odd or even and if it is a multiple of 10.

  • Hint: Odd numbers cannot be a multiple of 10

Example 1:

Sample Input:

-70

Sample Output:

Negative even number which is a multiple of 10

Example 2:

Sample Input:


Sample Output:

Input is 0

Example 3:

Sample Input:

11

Sample Output:

Positive odd number which is not a multiple of 10


1
Expert's answer
2021-08-23T01:19:23-0400
number=float(input("Enter a number: "))
if number > 0:
     print("Positive",end=" ")
elif number < 0:
    print("Negative",end=" ")
else:
    Input='0'
if number % 2==0 and number!=0:
    print("even number",end=" ")
elif number % 2!=0:
    print("odd number",end=" ")
else:
    Input='0'
if number % 10==0  and number !=0:
    print(" which is a multiple of 10")
elif number % 10 !=0:
    print(" which is not a multiple of 10")
else:
    print("Input is 0")
  

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS