[Tutor] Odds and even exercise

TJ Dack teejmd at gmail.com
Sat Mar 27 13:55:01 CET 2010


Hi, just started python at Uni and think i am in for a rough ride with zero
prior experience in programming.
Anyway my problem that i can't fix my self after googling.

The exercise is to generate a list of odd numbers between 1-100 and the same
for even numbers.

So far this is what i haveCODE: SELECT
ALL<http://python-forum.org/pythonforum/viewtopic.php?f=3&t=17610#>#A
way to display numbers 1 - 100
numbers = range(100)
#A way to display all odd numbers
odd = numbers[::2]
#A way to display all even numbers


I can't find a way to easily list the even numbers, i really need a easier
way to find answers my self but using the help docs in idle didn't get me
far, any tips that you guys have when you come across something you can't
solve?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100327/6dbf36ad/attachment.html>


More information about the Tutor mailing list