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
1 parent
ca6562e
commit bc4d4bc
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [Fácil]/python/sirnas1983.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,29 @@ | ||
|
||
def palabra_100_puntos(): | ||
print(''' | ||
Reglas: Para ganar debe ingresar una palabra y que la suma de sus | ||
letras sea de 100 puntos. La letra 'a' equivale a 1 punto y la 'z' | ||
a 27 puntos.No distingue mayusculas de minusculas! ¡A divertirse! | ||
''') | ||
palabra = input("Ingrese una palabra: ") | ||
play = True | ||
while play: | ||
puntos = 0 | ||
for letra in palabra: | ||
punto = ord(letra.upper()) - 64 | ||
if punto in range(1,28): | ||
puntos += punto | ||
if puntos == 100: | ||
print("¡Has logrado escribir una palabra de 100 puntos!") | ||
print("¡Felicitaciones!") | ||
break | ||
else: | ||
print(f'Tu palabra sumó {puntos} puntos') | ||
print('¿Deseas intentarlo nuevamente? (S/N)') | ||
if input()[0].upper() == "S": | ||
palabra = input("Ingrese una palabra: ") | ||
else: | ||
print("¡Gracias por participar!") | ||
break | ||
|
||
palabra_100_puntos() |