-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6035 from Akihiro93/main
Retos cumplido
- Loading branch information
Showing
6 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
Retos/Reto #37 - COLORES HEX Y RGB [Media]/go/Akihiro93.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]) | ||
} |
19 changes: 19 additions & 0 deletions
19
Retos/Reto #37 - COLORES HEX Y RGB [Media]/python/Aknihiro93.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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")) |
16 changes: 16 additions & 0 deletions
16
Retos/Reto #40 - TABLA DE MULTIPLICAR [Fácil]/go/Akihiro93.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Retos/Reto #40 - TABLA DE MULTIPLICAR [Fácil]/python/Akihiro93.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}") |
41 changes: 41 additions & 0 deletions
41
Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [Fácil]/go/Akihiro93.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
22 changes: 22 additions & 0 deletions
22
Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [Fácil]/python/Akihiro93.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |