Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .github/workflows/python.yml

This file was deleted.

86 changes: 86 additions & 0 deletions golang/internal/codewars.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package internal

import "sort"

func EvenOrOdd(x int) (answer string) {
if (x % 2) == 0 {
answer = "Even"
} else {
answer = "Odd"
}
return
}

func Sheep(sheep []bool) (answer int) {
answer = 0
for _, value := range sheep {
if value {
answer += 1
}
}
return
}

func CountWithSon(number int) (answer []int) {
for i := 1; i <= number; i++ {
answer = append(answer, i)
}
return
}

func School(n, m int) (answer int) {
if (n < 0) || (m < 0) {
answer = 0
} else {
answer = n * m
}
return
}

func LuckyHero(bullets, dragons int) (answer bool) {
if float32(bullets/2.0) >= float32(dragons) {
answer = true
} else {
answer = false
}
return
}

func PolToEng(message string) (answer string) {
var alphabet = map[string]string{
"ą": "a",
"ć": "c",
"ę": "e",
"ł": "l",
"ń": "n",
"ó": "o",
"ś": "s",
"ź": "z",
"ż": "z",
}
for _, x := range message {
if alphabet[string(x)] != "" {
answer += alphabet[string(x)]
} else {
answer += string(x)
}
}
return
}

func FindAll(arr []int, k int) (answer []int) {
for index, value := range arr {
if value == k {
answer = append(answer, index)
}
}
return
}

func OnlyMin(arr [][]int) (answer int) {
for _, n_1 := range arr {
sort.Ints(n_1[:])
answer += n_1[0]
}
return answer
}
17 changes: 15 additions & 2 deletions golang/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
package main

import "fmt"
import (
"fmt"

"isuct.ru/informatics2022/internal"
)

func main() {
fmt.Println("Hello world")
fmt.Println("Even or odd:", internal.EvenOrOdd(10))
fmt.Println("Counting sheep:", internal.Sheep([]bool{
true, true, true, false, false, true, true,
}))
fmt.Println("Monkey count:", internal.CountWithSon(15))
fmt.Println("School:", internal.School(5, 5))
fmt.Println("Hero:", internal.LuckyHero(9, 4))
fmt.Println("Polish messages:", internal.PolToEng("Jędrzej Błądziński"))
fmt.Println("7:", internal.FindAll([]int{6, 9, 3, 4, 3, 82, 4}, 3))
fmt.Println("8:", internal.OnlyMin([][]int{{1, 2, 3, 4, 5}, {5, 6, 7, 8, 9}, {20, 21, 35, 56, 100}}))
}
3 changes: 0 additions & 3 deletions python/.flake8

This file was deleted.

206 changes: 0 additions & 206 deletions python/.gitignore

This file was deleted.

15 changes: 0 additions & 15 deletions python/.vscode/launch.json

This file was deleted.

7 changes: 0 additions & 7 deletions python/.vscode/settings.json

This file was deleted.

Loading