Having both if() and for() statements in one liner
Robert Kern
robert.kern at gmail.com
Tue Sep 17 08:52:35 EDT 2013
On 2013-09-17 13:02, Ferrous Cranus wrote:
> o want to avoid having to type somehting like this:
>
> if person="George":
> times in range(0, 5):
>
>
> Why it gives me an error when i'm trying to write it like this:
>
>
> if person="George" for times in range(0, 5):
>
> Can't i ahve both if and for in a one liner?
Not in Python, no.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list