forked from mouredev/retos-programacion-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [Fácil]/python/pyramsd.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from unidecode import unidecode | ||
|
||
alfabeto = [] | ||
for i in range(97, 123): | ||
alfabeto.append(chr(i)) | ||
|
||
alfabeto.insert(alfabeto.index("n") + 1, "ñ") | ||
|
||
while True: | ||
|
||
word = input("Introduce una palabra: ") | ||
|
||
unicode_word = unidecode(word.lower().replace( | ||
"ñ", "_$_")).replace("_$_", "ñ") | ||
|
||
val = 0 | ||
|
||
for letra in unicode_word: | ||
if letra in alfabeto: | ||
val += alfabeto.index(letra) + 1 | ||
|
||
print(f"El valor de \"{word}\" es {val}") | ||
|
||
if val == 100: | ||
print("Has introducido una palabra de 100 puntos! El programa finalizará.") | ||
break |