Hi,

Can i use a build-in function .index() inside the loop or is its big-O-notation o(n) so it changes the big-O-notation of whole algorithm to o(n^2) ?

Even if it's O(n), in this case it is counted as O(1) because the string is of constant and independent length, which is the 26.

Yuval - your answer is correct.

index() is indeed O(n) in the worst case for a list of size n, because Python must linearly go over all the elements in.

However, when the list is of constant size, this becomes O(1).

so if i use a function like lst.count ( on **in**constant length) in a loop that is constant it's O(n) too, right?

What do you mean by *"loop that is constant"*? A loop that runs a constant number of times? A loop that performs a constant number of operations each iteration?

can i assume, that the list input is from the form ['b','c','d','r','a'] that each lst[i] is from type string? , and not [b,c,d,r,a],(in the example it was like this (the command list("bcdra") turn is to ['b','c','d','r','a'] ) , thanks

What is [b,c,d,r,a]? are these variables?

Anyway, the answer is in the execution example, as you mentioned.