On 17 September 2012 12:04, Santosh Kumar <sntshkm...@gmail.com> wrote:
> Here is the script: > > 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: ") > current = alphabets.index(i) > print(current) > next = current+1 > print(next) > print(alphabets.index(next)) > > I am getting a ValueError. > > And as you can see, I just trying to get the next item. So is there > any way I can get same functionality in less line of codes? > > <SNIP> When you access index the second time you are trying to do so with the value of the index. -- 0 1 0 0 0 1 1 1 1
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor