File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ # A while-loop will keep executing the code block under it as long as a boolean expression is True.
2
+ # If we write a line and end it with a colon then that tells Python to start a new block of code.
3
+ # Then we indent and that is the new code.
4
+ # This is all about structuring your programs so that Python knows what you mean.
5
+ # If you do not get that idea then go back and do some more work with if-statements, functions, and the for-loop until you get it.
6
+
7
+ # SAMPLE CODE
8
+
9
+ i = 0
10
+ numbers = []
11
+ while i < 6 :
12
+ print "At the top i is %d" % i
13
+ numbers .append (i )
14
+ i = i + 1
15
+ print "Numbers now: " , numbers
16
+ print "At the bottom i is %d" % i
17
+ print "The numbers: "
18
+ for num in numbers :
19
+ print num
You can’t perform that action at this time.
0 commit comments