print "Enter numbers, stops when negative value is entered:"
nums = []
while True: # infinite loop
try: n = int(raw_input("Enter a number: ")) # raw_input returns a string, so convert to an integer
except ValueError:
n = -1
print "Not a number!"
if n < 0: break # when n is negative, break out of the loop
else: nums.append(n)
print "Maximum number: {}".format(max(nums))