If I have the names, "johy" and "bobby," how can I use the computer to sort those?
If I compare them to each other numerically it doesn't seem to hold for all conditions.
Consider:
def listsum(numList):
theSum = 0
for i in numList:
theSum = theSum + i
retu theSum
test = 0
mystr='BA'
for code in map(ord, mystr):
test = test + listsum([code])
print(test)
131
and then change,
mystr='AZ'
get 155.
So, I can't just do an ASCII comparison. So what do I use for a basis if I do it manually? I do not want to use any particular language or any built in sort methods.
