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)
Comments
Leave a comment