CMU Recitation 2 Practice

A few learnings from CMU Recitation Practice

I. Parenthesis No in For Loops

This works

Adding parenthesis around the for loop syntax does not

II. Why Triangular Works

Thanks to Pete for showing me this — why does triangular work out to k*(k+1)/2?

Take 1 + 2 + 3 + 4 + 5 + 6 — this is k = 6. n =3

1 + …. + 6 = 1 + k

2 + … + 5 = 1 + k

3 +

n = k*(k+1)/2

III. Spelling Ceil Correctly

math.ceil is a function in python, math.ciel is not