[Tutor] Tutor Digest, Vol 103, Issue 82

Emile van Sebille emile at fenx.com
Tue Sep 18 00:16:08 CEST 2012


On 9/17/2012 2:24 PM Aaron Pilgrim said...
> Hello, I am new to python.
> Here is what I wrote.
> my lower() function does not work and it can not take capital letters.
>
> def func3():
> 	alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
> 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
> 'z']
> 	i = input("Press any English alphabet: ")
> 	i.strip().lower()

the preceeding line doesn't change i like you expect.  Try it as

         i = i.strip().lower()

HTH,

Emile


> 	current = alphabets.index(i)
> 	print("current index value: ", current)
> 	next = (current + 1) % 26
> 	print("next index value: ", next)
> 	print("The next letter is...", alphabets[next])
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>




More information about the Tutor mailing list