Hangman

On a recent train ride I made a little pyhon program to play Hangman.
My version has 7 stages (you could implement more by changing the ‘STAGES’ variable) and is at best playable if you have someone else who gives you a word (you can also type ‘r’ for a random word, but the list of random words is not very long).
Insert the wordGuessWin! (or lose...)


# Python 2.7.7 Code
# Jonathan Frech April the 7th, 2015

Continue reading

φ Generator

This program generates φ, also called the golden ratio. It creates the fibonacci sequence \big\{1, 1, 2, 3, 5, 8, 13, \dots\big\} and divides the newly generated number by the last one. In theory this program would generate exactly φ.Terminal Output

Fibonacci sequence

\text{Start: } x_1 = 1 \text{ and } x_2 = 1
\text{Generation: } x_n = x_{n-1} + x_{n-2}

1 + 1 = 2
1 + 2 = 3
2 + 3 = 5
3 + 5 = 8
5 + 8 = 13
8 + 13 = \dots

The golden ratio (φ)

\phi \text{ is the ratio between } x_n \text{ and } x_{n-1}\text{.}
\phi = \frac{x_n}{x_{n-1}}


# Python 2.7.7 Code
# Jonathan Frech 6th of April, 2015

Continue reading