Skip to content

Commit

Permalink
Merge branch 'mouredev:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
guillepinto authored Nov 6, 2023
2 parents b5ccda6 + 1c05fb2 commit cf71619
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/bertilein.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
* Escribe un programa que muestre por consola (con un print) los
* números de 1 a 100 (ambos incluidos y con un salto de línea entre
* cada impresión), sustituyendo los siguientes:
* - Múltiplos de 3 por la palabra "fizz".
* - Múltiplos de 5 por la palabra "buzz".
* - Múltiplos de 3 y de 5 a la vez por la palabra "fizzbuzz".
"""


def print_fixx_buzz():

cadena = ""

for i in range(100):
if ((i+1)%3 == 0) and ((i+1)%5 == 0):
cadena="fizzbuzz"
elif ((i+1)%3 == 0) :
cadena="fizz"
elif ((i+1)%5 == 0) :
cadena="buzz"


else :
cadena=i+1

print(cadena)



print_fixx_buzz()
36 changes: 36 additions & 0 deletions Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/python/patotal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
letras = {
"a" : "4",
"b" : "I3",
"c" : "[",
"d" : ")",
"e" : "3",
"f" : "|=",
"g" : "&",
"h" : "#",
"i" : "1",
"j" : ",_|",
"k" : ">|",
"l" : "1",
"m" : "/\/\\",
"n" : "^/",
"o" : "0",
"p" : "|*",
"q" : "(_,)",
"r" : "I2",
"s" : "5",
"t" : "7",
"u" : "(_)",
"v" : "\/",
"w" : "\/\/",
"x" : "><",
"y" : "j",
"z" : "2",
" " : " ",
}

frase = input("Frase a convertir: ")
resultado = ""
for i in frase.lower():
resultado += letras.get(i, i)

print(resultado)
36 changes: 36 additions & 0 deletions Retos/Reto #27 - CUENTA ATRÁS [Media]/python/jduque1989.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import time

# Funcion para solicitar al usuario los parametros y validación

def data_input():
while True:
try:
count_init = int(input("Enter a number to start countdown: "))
step = int(input("Enter a step size: "))
checker(count_init, step)
except ValueError:
print("Error, please enter a number")


# Funcion para revisar que cumpla la condición de enteros positivos

def checker(count_init, step):
if count_init < 0 or step < 0:
print("Error, please enter a positive number")
data_input()
else:
count_down(count_init, step)

# Funcion de la cuenta regresiva

def count_down(count_init, step):
while count_init >= 0:
print(count_init)
time.sleep(step)
count_init -= 1
if count_init == 0:
print("Blast off!")
break


data_input()
49 changes: 49 additions & 0 deletions Retos/Reto #4 - PRIMO, FIBONACCI Y PAR [Media]/python/bertilein.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""
/*
* Escribe un programa que, dado un número, compruebe y muestre si es primo, fibonacci y par.
* Ejemplos:
* - Con el número 2, nos dirá: "2 es primo, fibonacci y es par"
* - Con el número 7, nos dirá: "7 es primo, no es fibonacci y es impar"
*/
"""
import math as m

def is_even(number)->bool:
return ((number%2)==0)

def is_prime(number)->bool:

upperbound = m.sqrt(number)
i = 2
while ( number % i != 0 ) and (i <= upperbound):
i=i+1

return i>upperbound


def is_perfect_square(number)->bool:
square = int(m.sqrt(number))
return ((square*square) == number )


def is_fibonacci(number)->bool:
return is_perfect_square(5*number*number+4) or is_perfect_square(5*number*number-4)


def is_prime_fib_even(number)->str:
es_primo = (' no', '')[is_prime(number)] + ' es primo, '
es_fibonacci = (' no', '')[is_fibonacci(number)] + ' es fibonacci, '
es_par = (' es impar ', ' es par')[is_even(number)]

return es_primo+es_fibonacci+es_par

num1 = 2
num2 = 7

print(num1 , is_prime_fib_even(num1))
print(num2 , is_prime_fib_even(num2))

# Más Tests :P - del 2 al 19
for i in range(1,20):
print(i , is_prime_fib_even(i))

0 comments on commit cf71619

Please sign in to comment.