Skip to content
Projetos

cblte/100-golang-exercises

Ver no GitHub

Sobre

100 challenging programming exercises for golang with solutions

Aprendizado e educação

Como estes números são medidos

Crescimento medido de estrelas

em 24 h
0
em 7 dias
0
em 15 dias
+1
em 1 mês
Coletando histórico

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original

100+ challenging Golang programming exercises

Carsten Brueggenolte <[email protected]> v1.0.0, March 2021: Initial Document

These challenges come from a file called "100+ Python challenging programming exercises" I found somewhere on the internet. I want to rewrite all exercises for Golang!

I will update the file along with me rewriting the solutions provided in Python. Furthermore, I will also put a file for each solution into a subdirectory, so it can be run locally. Some smaller single file solutions can also be run in the Golang playground.

This is also a training for myself to learn the language and to exercise writing code. I also want to write tests for most of the apps, because I think, tests are always forgotten, and I also should write more tests when writing code.

The exercises for the different levels (see below) are split into the respective files.

But before that, here are the links to the files:

Practice

Every exercise from 001 to 020 ships with a practice/ subfolder containing an empty function stub and the same tests as the reference solution. Open practice.go, fill in your answer, then run the tests for that exercise.

General workflow

# From the repo root, run any practice with:
go test ./<NNN>/practice/...

# Or cd into it first and run the local tests:
cd <NNN>/practice
go test ./...

# Useful flags
go test -v ./...        # verbose — show every test name
go test -run TestEx001  # only run a specific test

Run one exercise at a time

go test ./001/practice/...   # Exercise 001 — divisible by 7, not by 5

Run them all at once

# All practice packages from the repo root (Go's "..." wildcard
# matches any path segment, including the NNN folders).
go test ./.../practice/...

# Verbose
go test -v ./.../practice/...

The reference implementation lives next to each practice folder (e.g. 001/exercise001.go) so you can compare once you're done.

Level description

Here is the original description of the python file for the different exercises.

Level 1 Beginner

Beginner means someone who has just gone through an introductory Golang course. He can solve some problems with 1 or 2 Golang classes or functions. Normally, the answers could directly be found in the textbooks.

Level 2 Intermediate

Intermediate means someone who has just learned Golang, but already has a relatively strong programming background from before. He should be able to solve problems which may involve 2 or 3 Golang classes or functions. The answers cannot be directly be found in the textbooks.

Level 3 Advanced

Advanced means you should use Golang to solve more complex problem using more rich libraries functions and data structures and algorithms. The user is supposed to solve the problem using several Golang standard packages and advanced techniques.

Remark

This repository is in no way complete and should be considered complete. I'm still learning the language go myself and there are still some bugs here and there. If you find one, please let me know. Gladly also by a pull request.

Thanks

Explore projetos relacionados

Carregando…