Beginner question

Anssi Saari as at sci.fi
Tue Jun 4 03:45:38 EDT 2013


eschneider92 at comcast.net writes:

> Is there a more efficient way of doing this? Any help is gratly appreciated.

Efficiency in a short program isn't a big thing. You have some pretty
weird things in there, there's no need make single element tuples out of
your strings and then putting those in a list. Just put the strings in a
tuple and go. Likewise there's really no point in having while loops
where you exit on the first round now is there? Just use an if.

BTW, did I get the logic correctly, the end result is random? If true
then the logic can be simplified greatly, you can just discard the user
input and print a random choice of your three result strings...



More information about the Python-list mailing list