From f1fbfe725418ed6837f37cefcd84987ec5e0b6da Mon Sep 17 00:00:00 2001 From: Majinka10 Date: Mon, 22 May 2023 14:20:23 -0500 Subject: [PATCH 1/2] Reto #20 - Python --- .../python/majinka10.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Retos/Reto #20 - LA TRIFUERZA [Media]/python/majinka10.py diff --git a/Retos/Reto #20 - LA TRIFUERZA [Media]/python/majinka10.py b/Retos/Reto #20 - LA TRIFUERZA [Media]/python/majinka10.py new file mode 100644 index 0000000000..ab9c7024ed --- /dev/null +++ b/Retos/Reto #20 - LA TRIFUERZA [Media]/python/majinka10.py @@ -0,0 +1,13 @@ +def primero(n:int): + for i in range(n): + print(' ' * (2*n-i-1) + '*' * (2*i+1)) + +def segundo(n:int): + for i in range(n): + print(' ' * (n-i-1) + '*' * (2*i+1) + ' ' * (2*n- (i*2) -1) + '*' * (2*i+1)) + +def trifuerza(n:int): + primero(n) + segundo(n) + +trifuerza(5) \ No newline at end of file From b8630390794ccc2552944d93b323142ab6865c48 Mon Sep 17 00:00:00 2001 From: Majinka10 Date: Mon, 22 May 2023 14:37:19 -0500 Subject: [PATCH 2/2] Reto #21 - Python --- .../python/majinka10.py" | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 "Retos/Reto #21 - N\303\232MEROS PRIMOS GEMELOS [Media]/python/majinka10.py" diff --git "a/Retos/Reto #21 - N\303\232MEROS PRIMOS GEMELOS [Media]/python/majinka10.py" "b/Retos/Reto #21 - N\303\232MEROS PRIMOS GEMELOS [Media]/python/majinka10.py" new file mode 100644 index 0000000000..1b25e0d754 --- /dev/null +++ "b/Retos/Reto #21 - N\303\232MEROS PRIMOS GEMELOS [Media]/python/majinka10.py" @@ -0,0 +1,25 @@ +import math + +def is_prime(n:int): + if n>1: + for i in range(2,int(math.sqrt(n))+1): + if (n%i) == 0: + return False + return True + else: + return False + +def primos_gemelos(rango:int): + primos=[] + gemelos=[] + for i in range(1,rango): + if is_prime(i): + primos.append(i) + for n,j in enumerate(primos): + if n