Last active
November 18, 2022 12:37
-
-
Save juanfal/63cabaaaee15bac6ad2016b6f6eed39d to your computer and use it in GitHub Desktop.
mismo conjunto de letras en dos cadenas sin funciones de python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# t08.mismoConjuntodeletras.py | |
# juanfc 2020-12-09 | |
# https://gist.github.com/63cabaaaee15bac6ad2016b6f6eed39d | |
def estaEn(cad, let): | |
i = 0 | |
while i < len(cad) and cad[i] != let: | |
i += 1 | |
return i < len(cad) | |
def mismoConjuntodeletras(a, b): | |
porAhora = True | |
i = 0 | |
while i < len(a) and porAhora: | |
porAhora = estaEn(b, a[i]) | |
i+=1 | |
i = 0 | |
while i < len(b) and porAhora: | |
porAhora = estaEn(a, b[i]) | |
i+=1 | |
return porAhora | |
def printPruebas(s1, s2): | |
if mismoConjuntodeletras(s1, s2): | |
print(f"{s1} <===> {s2}") | |
else: | |
print(f"{s1} <=/=> {s2}") | |
# ----------- | |
printPruebas("mirarroma", "amorio") | |
printPruebas("mxrarroma", "amorio") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment