[Courses] [python] Lesson 2: Loops, if, and beer
Laylaa
laylaa+linuxchix at gmail.com
Fri Jun 24 22:54:58 UTC 2011
Okay, I must admit I "skipped" the first lesson.
Or I should clarify, I did it but I didn't post it.
And, no I didn't know it was a Monty Python reference but I got everything
else I think.
Laylaa
---------------------------------------------------
1)
for i in range(99, 0, -1):
print i, "bottles of beer on the wall,", i, "bottles of beer"
2) [ ]
It starts at 0, and says count down in increments of 1 until the counter
reaches 10. But it will never reach 10 so nothing is in the range.
3) ok. I think it's a good size for the beginner.
4)
for i in range(1, 6):
if i == 1:
print "one"
elif i==2:
print "two"
elif i==3:
print "three"
elif i==4:
print "four"
else:
print "five"
More information about the Courses
mailing list