[Tutor] Problems understanding List reverse()
Wesley Abbott
wesleyabbott@hotmail.com
Wed, 24 Apr 2002 16:02:41 -0600
Hello everyody.
I am having a slight problem with relation to 'list.reverse'. I am able ot
get the reverse to work if a list is static, but if I have a user input
information it does not seem to abe able to reverse. Please help. Code is
below. TIA for all your help. I am totally new to programming, coming from a
network engineer background. I am going through Wesley Chun's book right
now. I also have the O'Reilly Learning to program Python. Once again thanks
to all who can help me. I have all the different lists jsut to help me
figure this out. Not trying to confuse anybody, :)
# a simple reverse function
def reversel(list):
list.reverse()
return list
alist = []
alist2 = [1, 2, 3, 4, 5]
alist.append(raw_input('Enter a string: '))
print alist
print reversel(alist)
a = reversel(alist2)
print a
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com