User manual
18
i += 1 In each instance – not anymore indented – the counter i that counts the attempts is increased by
one. The line with the operator
+= equals i = i + 1.
print “You guessed the number in ",i,". Guesses”
This line is more indented, which means that the while loop ends here. If the statement is not true any
longer, that is, if the number
guess guessed by the user is not unequal (but equal) the number of the secret
number, then this text is displayed which consists of two parts of a sentence and the variable i and shows
how many attempts were needed by the player. Python programs don’t require a special statement to exit.
They simply end after the last command is executed or after a loop that is no longer running and not
followed by additional statements.
2 The first LED on Raspberry Pi is illuminated
The 26-pin block in the corner of the Raspberry Pi provides the option to connect hardware directly in order
to make inputs via push buttons or to illuminate LEDs controlled by a program for instance. This pin header
is referred to as GPIO. The abbreviation stands for "General Purpose Input Output".
17 of these 26 pins can be used for the digital input or output and as such can be utilized for a variety of
hardware add-ons. The remaining pins are defined for the power supply and other purposes.
Fig. 2.1: Mapping the GPIO interface The gray line up and on the left indicates the border of the board. GPIO pin 2 lies therefore at
the outer edge in the corner of the Raspberry Pi.