[Tutor] How to make to exit the loop, while typing Enter

John Joseph jjk_saji at yahoo.com
Tue Jan 3 13:25:19 CET 2006


Hi 
    I am trying to write a program in which it ask for
entries for the list , But if I press Enter it  should
exit  the while loop without giving errors ,I have
problem in making it work , right now if I press enter
to exit , the program terminates showing error 
        I am added my script which I wrote 
                              Advice requested 
                                          Thanks 
                                               Joseph

********************************************************************

#
#   How to exit , when user Press Enter
#   While Entering Data
#

# define array
array = []
m = 0
print "Enter  to exit"
m = int(raw_input("Enter the  Values for  The Array : 
"))
array.append(m)
print array
while m != "":
        m = int(raw_input("Enter the  Values for  The
Array :  "))
        array.append(m)
        print array



	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com


More information about the Tutor mailing list