Thread
:
loops
View Single Post
May 1st, 2007, 5:25 PM
#
5
ptmcg
Newbie
Join Date: Aug 2005
Location: Austin, TX
Posts: 15
Rep Power:
0
If you are looping for the purpose of building a list, read up on list comprehensions. Here is a quick way to build a list of the odd numbers up to 20:
(
Toggle Plain Text
)
print [c for c in range(20) if c%2 ]
print [c for c in range(20) if c%2 ]
ptmcg
View Public Profile
Visit ptmcg's homepage!
Find More Posts by ptmcg