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.
Merge pull request mouredev#4373 from Majinka10/main
Retos 28 al 30 - Python
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
Retos/Reto #28 - EXPRESIÓN MATEMÁTICA [Media]/python/majinka10.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,15 @@ | ||
import re | ||
|
||
patron = re.compile(r'-?\d+(\.\d+)?\s*[+\-*/%]\s*-?\d+(\.\d+)?(?:\s*[+\-*/%]\s*-?\d+(\.\d+)?)?') | ||
|
||
def evaluador(expresion:str): | ||
match = patron.search(expresion) | ||
if match: | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
print(evaluador('5 + 6 / 7 - 4')) | ||
print(evaluador('5 a 3')) | ||
print(evaluador('3.2 % 3 + 5 - 3 / 2')) |
13 changes: 13 additions & 0 deletions
13
Retos/Reto #29 - EL CARÁCTER INFILTRADO [Fácil]/python/majinka10.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,13 @@ | ||
def infiltrado(texto1:str,texto2:str): | ||
infiltrados=[] | ||
if len(texto1) == len(texto2): | ||
for tupla in zip(texto1,texto2): | ||
if tupla[0] != tupla[1]: | ||
infiltrados.append(tupla[0]) | ||
else: | ||
return print('Los textos no tienen el mismo tamaño') | ||
return print(infiltrados) | ||
|
||
infiltrado('abc','abdc') | ||
infiltrado('Me llamo mouredev','Me llemo mouredov') | ||
infiltrado('Me llamo.Brais Moure','Me llamo brais moure') |
13 changes: 13 additions & 0 deletions
13
Retos/Reto #30 - EL TECLADO T9 [Media]/python/majinka10.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,13 @@ | ||
t9_dict={'1':',','11':'.','111':'?','1111':'!','2':'A','22':'B','222':'C','3':'D','33':'E','333':'F','4':'G','44':'H','444':'I','5':'J','55':'K','555':'L','6':'M','66':'N','666':'O','7':'P','77':'Q','777':'R','7777':'S','8':'T','88':'U','888':'V','9':'W','99':'X','999':'Y','9999':'Z','0':' '} | ||
|
||
def convert_to_t9(texto:str): | ||
texto=texto.split('-') | ||
text_t9='' | ||
for bloque in texto: | ||
if bloque in t9_dict: | ||
text_t9+=t9_dict[bloque] | ||
else: | ||
return print('Bloque de números no encontrado') | ||
return print(text_t9) | ||
|
||
convert_to_t9('44-666-555-2-0-555-444-66-3-88-777-2-1111') |