golang / tour

[mirror] A Tour of Go
BSD 3-Clause "New" or "Revised" License
1.53k stars 521 forks source link

tour: No calculus, please #169

Open drguildo opened 7 years ago

drguildo commented 7 years ago

Context: https://tour.golang.org/flowcontrol/8

As a simple way to play with functions and loops, implement the square root function using Newton's method.

I guess I just had a very poor mathematics education but I don't know calculus, numerical analysis etc. and would really like to "play with functions and loops" in Go without having to play with advanced mathematics at the same time.

bgadrian commented 6 years ago

I have found other duplicates of the same problem "too much math in tour":

https://github.com/golang/tour/issues/189 https://github.com/golang/tour/issues/193

bgadrian commented 6 years ago

We need to find a new example, probably computer science / math related, or a fun mini game with the following constraints:

Repeat a string

Multiply the input string, X times and return the result?

I'm concerned that using a String builder is too much for the user, and not using it (string concatenation) would be a bad example.

Print the input

Print the input x times

The exercise would be too simple?

Multiplication

Multiply the two input numbers, without using the * operator. Tip: you can use +

I think it's is the perfect mix between CS and math.

Loto numbers

Print out 7 random numbers between 1 and 70. Tip: you can use the Rand.Intn(70) to generate a random number between 0 and 70.

Extra we can add how many numbers to print and the maximum, each country has their own system. Edit: nvmd, Rand doesn't work in playground :(