-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6654 from astrosinfinitos/main
He realizado el reto 40, el de las tablas de multiplicar
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
Retos/Reto #40 - TABLA DE MULTIPLICAR [Fácil]/python/astrosinfinitos.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,22 @@ | ||
# | ||
# Crea un programa que sea capaz de solicitarte un número y se | ||
# - Debe visualizarse qué operación se realiza y su resultado. | ||
# Ej: 1 x 1 = 1 | ||
# 1 x 2 = 2 | ||
# 1 x 3 = 3 | ||
# ... | ||
# | ||
|
||
|
||
entrada_validada = False | ||
numero_para_multiplicar = int(input("Introduce un número: ")) | ||
|
||
while ( | ||
not entrada_validada | ||
): # Compruebo con el try except que efectivamente hemos introducido un número | ||
try: | ||
for i in range(1, 11): | ||
print(f"{numero_para_multiplicar} x {i} = {numero_para_multiplicar * i}") | ||
entrada_validada = True | ||
except ValueError: | ||
print("Por favor, introduce un número válido.") |