Bryon Adams <bryonad...@openmailbox.org> writes:

>     I'm very new to python so please forgive what may be a beginner
> question.

Welcome! You are in the right place for asking beginner Python questions
:-)

> I'm thinking there should be a way to do this without the for loop I
> used, but I'm at a loss here.

Thank you for posting your code, and a specific question about it.

Why do you think there “should be a way to do this without the for
loop”? If you want to do something with a collection of items, a ‘for’
loop is quite a normal way to do that.

(In fact you have not used a for loop, you have used a different syntax
called a “list comprehension”. But the main question remains unchanged:
Why would you expect to not need some kind of iteration like a ‘for’?)

-- 
 \      “Probably the earliest flyswatters were nothing more than some |
  `\    sort of striking surface attached to the end of a long stick.” |
_o__)                                                     —Jack Handey |
Ben Finney

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to