We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4d77cc4 commit b693e47Copy full SHA for b693e47
1 file changed
samplewhile.py
@@ -0,0 +1,19 @@
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
0 commit comments