Skip to content

Commit

Permalink
Merge pull request mouredev#4373 from Majinka10/main
Browse files Browse the repository at this point in the history
Retos 28 al 30 - Python
  • Loading branch information
Roswell468 authored Jul 31, 2023
2 parents 7cbe5ca + e366dd4 commit 2759308
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
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'))
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 Retos/Reto #30 - EL TECLADO T9 [Media]/python/majinka10.py
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')

0 comments on commit 2759308

Please sign in to comment.