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
Paula2409 authored Apr 26, 2024
2 parents c2627e9 + 23b70b1 commit 6e2c5ce
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/go/raynerpv2022.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package main

import "fmt"

func main() {
fmt.Println("FIZZ BUZZ")
// if condition
for i := 1; i < 101; i++ {
if i%3 == 0 && i%5 == 0 {
fmt.Println("FIZZ BUZZ")
} else if i%3 == 0 {
fmt.Println("FIZZ")
} else if i%5 == 0 {
fmt.Println("BUZZ")
} else {
fmt.Println(i)
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Foundation

func fizzBuzz(num: Int = 100) {
for n in 0...num {
if n % 3 == 0 && n % 5 == 0 {
print("fizzbuzz")
continue
}

if n % 3 == 0 {
print("fizz")
continue
}

if n % 5 == 0 {
print("buzz")
continue
}

print(n)
}
}

fizzBuzz()




54 changes: 54 additions & 0 deletions Retos/Reto #4 - PRIMO, FIBONACCI Y PAR [Media]/python/Hugodiazz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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"



def esPar(numero):
if numero % 2 == 0:
return 'es par'
else:
return 'es impar'

def esPrimo(numero):
if numero <= 1:
return 'no es primo'
elif numero <= 3:
return 'es primo'
elif numero % 2 == 0 or numero % 3 == 0:
return 'no es primo'
i = 5
while i * i <= numero:
if numero % i == 0 or numero % (i + 2) == 0:
return 'no es primo'
i += 6
return 'es primo'

def enFibo(numero):
a, b, i = 0, 1, 0
while i <= numero:
c = a + b
a = b
b = c

if a == numero:
return 'es fibonacci'
break
elif a > numero:
return 'no es fiboncacci'
break

i += 1
return ''

def evaluarNumero(numero):
par = esPar(numero)
fibo = enFibo(numero)
primo = esPrimo(numero)

print(str(numero), primo, fibo + ' y ', par)


print(evaluarNumero(2))
print(evaluarNumero(7))
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import time


# Classical method known as the linear congruential generator (LCLG)
def pseudo_random_generator(seed=42):
if seed is None:
seed = int(time.time() * 1000) % 2 ** 32
a = 1664525
c = 1013904223
m = 2**32
xn = seed
while True:
xn = (a * xn + c) % m
yield xn % 101 # Devuelve un número entre 0 y 100


gen = pseudo_random_generator()
for _ in range(10):
print(next(gen))

0 comments on commit 6e2c5ce

Please sign in to comment.