Skip to content

Commit

Permalink
Reto mouredev#47 - python
Browse files Browse the repository at this point in the history
  • Loading branch information
pyramsd committed Dec 19, 2023
1 parent 10c2ef8 commit 2742bb8
Showing 1 changed file with 26 additions and 0 deletions.
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

0 comments on commit 2742bb8

Please sign in to comment.