I was fortunate enough to run an unconference at my company's recent offsite titled "programming for non-programmers". When deciding what tasks and challenges we could do as a group I settled on fizzbuzz. Fizzbuzz is a fairly simple programming challenge often presented to junior engineers. I will paste my solution below and then dive into why I think this is the perfect fit for non-programmers to get involved.
for fizzbuzz in range(51):
if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0:
print("fizzbuzz")
continue
elif fizzbuzz % 3 == 0:
print("fizz")
continue
elif fizzbuzz % 5 == 0:
print("buzz")
continue
print(fizzbuzz)
The seemingly simple code covers a number of new subjects for the non-programmer:
When discussing with the non-programmer it is important to first show the outcome of fizzbuzz:
1
2
fizz
4
buzz
fizz
7
8
fizz
buzz
11
fizz
13
14
fizzbuzz
...
From here a discussion can be lead with "what is happening here?", "if we were to do the same with a deck of cards, what would we do?".
The important part is deciding as a group what the order of operations should be, what the code is "deciding" to do and what that would look like as an ordered list of decisions rather than the actual code. Non-programmers shouldn't be too worried about the syntax of code but more concerned about setting up the logic gates around the problem.
Before even touching the code a list can be drawn up as so:
Getting started with code is infinitely easier than people think and we, as engineers, should be working to reduce these barriers for entry wherever possible. Showing how simple it would be to pass the first technical challenge in an interview is just the first step in this process