Can I use a conditional in a variable declaration?
volcs0 at gmail.com
volcs0 at gmail.com
Sat Mar 18 23:03:59 EST 2006
I've done this in Scheme, but I'm not sure I can in Python.
I want the equivalent of this:
if a == "yes":
answer = "go ahead"
else:
answer = "stop"
in this more compact form:
a = (if a == "yes": "go ahead": "stop")
is there such a form in Python? I tried playing around with lambda
expressions, but I couldn't quite get it to work right.
More information about the Python-list
mailing list