I am getting the error:
AttributeError: 'str' object has no attribute 'string'
So here is the code:
lnumber=input("please type in numbers:")
lnumber.string().sort()
print(lnumber)
What I'm trying to do is:
- user inputs numbers (e.g.:
'2 1 4 3'); and - the code puts the numbers in ascending order.
inputreturns astrobject, which doesn't have astringmethod - what were you expecting to happen? For the list of methods thatstrobjects do have, see: docs.python.org/2/library/stdtypes.html#string-methodsstr.string, though.