How to Teach Computational Thinking

Try It Yourself

This document is a live “notebook” that mixes text ​
​and code. You can run any piece of code by clicking ​
​inside the code, then pressing +.​
​​
​See here for a basic introduction.

​

Compute 2+2:

In[]:=
2+2
Out[]=
4
​

Raise 12 to the power 123:

12^123
​

Make a list of numbers from 1 to 10:

Range[10]
​

Make a list of numbers from 1 to 1000:

Range[1000]
​

Plot the list of numbers:

ListPlot[Range[10]]
​

Make a table of the first 20 primes:

Table[Prime[n],{n,20}]
​

Plot the table of primes:

In[]:=
ListPlot[Table[Prime[n],{n,20}]]
Out[]=
5
10
15
20
10
20
30
40
50
60
70
​

A list of colors: