Posició X28180


Statement
 

pdf   zip

thehtml

Programa una funció @pos_a(s, k)@ que rebi un string s i un enter no negatiu k i retorni la posició on es troba la k-èsima lletra a dins de s, o -1 si el string s té menys de k lletres a.

Sample session
>>> pos_a('', 1)
-1
>>> pos_a('hola', 2)
-1
>>> pos_a('ara', 3)
-1
>>> pos_a('lalaland', 3)
5
>>> pos_a('almendro', 1)
0
Information
Author
InfBesos
Language
Catalan
Other languages
English Spanish
Official solutions
Python
User solutions
Python