Throw of the dice

Most books on learning how to programme start with simple codes for you to try so you can get right into it and see the results pretty much immediately.

My first coding from the book, Programming the Raspberry Pi – Getting Stated with Python by Simon Monk, was a simple, but fun one, a simple dice game.

 

#3_1_dice

import random

for x in range(1,  11):

          random_number=random.randint(1, 6)

          print(random_number)

As simple as that (try it! you can give it a go on the internet through any good programme writing software like ShiftEdit)

For me starting out after nearly 25 years away from programming (in my day it was the BBC computer or the Commadore Plus 4!) it was a simple little programme that gave me a quick result and showed me that anyone can programme and that I can progress onto better things but that it will just take time and regular practice. But also for anyone who has never programmed before in their entire life it also gives a little encouragement to keep going when just a few simple lines can produce results!

Leave a comment