diff --git a/Retos/Reto #37 - COLORES HEX Y RGB [Media]/go/Akihiro93.go b/Retos/Reto #37 - COLORES HEX Y RGB [Media]/go/Akihiro93.go new file mode 100644 index 0000000000..4abb3fd04d --- /dev/null +++ b/Retos/Reto #37 - COLORES HEX Y RGB [Media]/go/Akihiro93.go @@ -0,0 +1,38 @@ +package main + +import ( + "fmt" + "log" + "strconv" + "strings" +) + +func main() { + fmt.Print("") + converter_rgb(8, 200, 33) + converter_hex("#08C821") +} + +func converter_rgb(r, g, b int) { + + var result string = "#" + for _, v := range([]int{r, g,b}) { + var hex_v string = "" + hex_v = fmt.Sprintf("%02X", v) + hex_v = strings.ToUpper(hex_v) + result = result + hex_v + } + fmt.Println(result) +} + +func converter_hex(hex string) { + var list_values []int64 + for _, v := range([]string{hex[1:3], hex[3:5], hex[5:7]}) { + i, err := strconv.ParseInt(v, 16, 64) + if err != nil { + log.Fatalln(err) + } + list_values = append(list_values, i) + } + fmt.Printf("(r: %d, g: %d, b: %d )",list_values[0], list_values[1], list_values[2]) +} diff --git a/Retos/Reto #37 - COLORES HEX Y RGB [Media]/python/Aknihiro93.py b/Retos/Reto #37 - COLORES HEX Y RGB [Media]/python/Aknihiro93.py new file mode 100644 index 0000000000..766eabb7d1 --- /dev/null +++ b/Retos/Reto #37 - COLORES HEX Y RGB [Media]/python/Aknihiro93.py @@ -0,0 +1,19 @@ +def converter_rgb(r:int, g:int, b:int) -> str: + if r > 255 or g > 255 or b > 255: + print("Error") + return "" + result = "#" + for i in [r, g, b]: + temp = i + i = hex(i)[2:] + if temp < 16: + i = i.zfill(2) + i = i.upper() + result = result + i + return result + +def converter_hex (HEX:str): + return f"(r: {int(HEX[1:3].lower(), 16)}, g: {int(HEX[3:5].lower(), 16)}, b: {int(HEX[5:7].lower(), 16)}" + +print(converter_rgb(255, 200, 33)) +print(converter_hex("#08C821")) diff --git "a/Retos/Reto #40 - TABLA DE MULTIPLICAR [F\303\241cil]/go/Akihiro93.go" "b/Retos/Reto #40 - TABLA DE MULTIPLICAR [F\303\241cil]/go/Akihiro93.go" new file mode 100644 index 0000000000..ab71f9ee4f --- /dev/null +++ "b/Retos/Reto #40 - TABLA DE MULTIPLICAR [F\303\241cil]/go/Akihiro93.go" @@ -0,0 +1,16 @@ +package main + +import ( + "fmt" +) + +func main() { + var number int + fmt.Print("Introduce un numero: ") + fmt.Scanf("%d", &number) + + for i := 1; i < 11; i++ { + result := number * i + fmt.Println(number ," x ", i, " = ", result) + } +} \ No newline at end of file diff --git "a/Retos/Reto #40 - TABLA DE MULTIPLICAR [F\303\241cil]/python/Akihiro93.py" "b/Retos/Reto #40 - TABLA DE MULTIPLICAR [F\303\241cil]/python/Akihiro93.py" new file mode 100644 index 0000000000..a2866c4aeb --- /dev/null +++ "b/Retos/Reto #40 - TABLA DE MULTIPLICAR [F\303\241cil]/python/Akihiro93.py" @@ -0,0 +1,10 @@ +while True: + try: + number = int(input("Introduce un numero: ")) + except: + print("Error") + else: + break + +for i in range(1, 11): + print(f"{number} x {i} = {number * i}") diff --git "a/Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [F\303\241cil]/go/Akihiro93.go" "b/Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [F\303\241cil]/go/Akihiro93.go" new file mode 100644 index 0000000000..96b8dd0fc6 --- /dev/null +++ "b/Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [F\303\241cil]/go/Akihiro93.go" @@ -0,0 +1,41 @@ +package main + +import ( + "fmt" + "strings" +) + +func main() { + var word string + for { + var failed bool + fmt.Print("Introduce la palabra: ") + fmt.Scanf("%s", &word) + + for _, v := range([]string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}) { + if strings.Contains(word, v) { + fmt.Println("Error") + failed = true + break + } + } + if !failed { + break + } + } + word = strings.ToLower(word) + + var result = 0 + var dict = map[string]int { + "a": 1, "b": 2, "c": 3, "d": 4, "e": 5, "f": 6, "g": 7, "h": 8, "i": 9, + "j": 10, "k": 11, "l": 12, "m": 13, "n": 14, "ñ": 15, "o": 16, "p": 17, + "q": 18, "r": 19, "s": 20, "t": 21, "u": 22, "v": 23, "w": 24, "x": 25, + "y": 26, "z": 27, + } + + for _, v := range word { + result += dict[string(v)] + } + + fmt.Println(result) +} \ No newline at end of file diff --git "a/Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [F\303\241cil]/python/Akihiro93.py" "b/Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [F\303\241cil]/python/Akihiro93.py" new file mode 100644 index 0000000000..2624ab2c57 --- /dev/null +++ "b/Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [F\303\241cil]/python/Akihiro93.py" @@ -0,0 +1,22 @@ +while True: + word = input("Introduce la palabra: ") + + for i in ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]: + if i in word: + print("Error") + exit() + break + +dict_values = { + 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, + 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'ñ': 15, 'o': 16, 'p': 17, + 'q': 18, 'r': 19, 's': 20, 't': 21, 'u': 22, 'v': 23, 'w': 24, 'x': 25, + 'y': 26, 'z': 27 +} + +for i in word: + result = 0 + for i in word.lower(): + result += dict_values[i] + +print(result) \ No newline at end of file