vault backup: 2023-11-30 09:05:07

This commit is contained in:
Louis Gallet 2023-11-30 09:05:07 +01:00
parent f6b0111241
commit 9409d1dad5
Signed by: lgallet
SSH Key Fingerprint: SHA256:qnW7pk4EoMRR0UftZLZQKSMUImbEFsiruLC7jbCHJAY

View File

@ -13,12 +13,13 @@ def search(x: str, s:str) -> int:
@params s (str): the string @params s (str): the string
@return: (int): the number of occurences @return: (int): the number of occurences
""" """
i = 1 i = 0
n = len(s) pos = -1
for loop in range(n): while i < len(s) and pos == -1:
if s[n] == x: if s[i] == c:
i += 1 pos = i
return i i += 1
return pos
def search2(s: str, x: str) -> int: def search2(s: str, x: str) -> int:
""" """