Working like a machine?
You need the right food for dinner… every day! But I often have the problem, that I cannot decide what I really want to eat. Some colleagues build a wheel of fortune a couple of years ago to find out wich fastfood they wanna eat… such as McDonalds, BurgerKing or somethig like this. I hate fastfood… especially fastfood made by McDonalds, Burgerking and Co… So I decided to build my own wheel of fortune (no not with black jack)… But another important fact is, that I do not have the skills to build a analog wheel of fortune by hand… So I decided to create a digital wheel of food fortune using only a few lines of python code…. as simple as possible. Quickly done 🙂
Here is the very simple python solution:
Very simple copy and paste that code into your texteditor software like SublimeText3 and save it as “somename.py”… oben up a CommandLine-Tool like Terminal on Mac and Linux or an cmd at Start > Run > “cmd” on Windows systems. Be sure to have Python installed already… Typin “python path name.py” to run the code 🙂
#python wheel of fortune "Lunch" import random options = ["sushi", "sandwich", "couscous", "fruits", "salad", "cookies"] count = len(options) print options[random.randrange(0, count, 1)]