Answer to Question #51460 in Python for ashpak

Question #51460
Accept number from user. Print message if number is equal to 0 or greater than 0 or less than 0.
Expert's answer
while True:
try:
n = int(raw_input('Please enter a number:'))
break
except ValueError as err:
print err
continue
if n == 0:
print 'Number \'{0}\' is equal to \'0\'.'.format(n)
elif n>0:
print 'Number \'{0}\' is more than \'0\'.'.format(n)
else:
print 'Number \'{0}\' is less than \'0\'.'.format(n)

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 first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal