Q: Console: List index out of range I know it's a kinda a dumb question but why is there an index error list index out of range when i run my code?    
def ilepar(liczba):
    out = 0
    lst = []
    for n in liczba:
        lst.append(int(n))
    for i in lst:
        if i == lst[i + 1]:
            out += 1
        else:
            pass

    return out


print(ilepar('123'))


A: During the call ilepar('123'), what happens is:
1) after the first for loop, the list  lst is built as lst = [1,2,3]. Therefore, lst is a list of 3 elements and you can access them with indices 0-2 (lst[0]=1, lst[1]=2, lst[2]=3)
2) in your second for loop, i takes each of the values of lst. So at the first iteration, i=1, then you compare 1 to lst[1+1] which is okay because 1+1=2 is a valid index in lst. At the second iteration, i=2 and you compare it with lst[2+1] and this leads to index out of bounds because 3 is not a valid index in lst!

A: In these two lines:
for i in lst:
    if i == lst[i + 1]:

You're using i both to refer to the item in the list, and as an index. This is unfortunately incorrect. for i in lst assigns i to each element in the list.
Even if i was an index, lst[i + 1] will raise an IndexError when you reach the end of the list, since you'd try to index an element that is one greater than the length of the list.

There are multiple different ways of dealing with this issue. The best would probably be to use enumerate() (https://docs.python.org/3/library/functions.html#enumerate), which gives you both the index and the item:
for index, item in enumerate(lst):
    if index + 1 < len(lst) and item = lst[index + 1]:
        ...

You could also use zip() (https://docs.python.org/3/library/functions.html#zip) to retrieve pairs of elements from the same list, by using lst[1:] to get the "next" element:
for a, b in zip(lst, lst[1:]):
    if a == b:
        ...


A: your second for loop it is accessing an index grather than length of your list lst
if you want to iterate over the lst index  you can use: 
 for i in range(len(lst) -1):
    if lst[i] == lst[i + 1]:
        out += 1

