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.
1
Expert's answer
2015-03-19T14:06:50-0400
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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS