[Tutor] Shadowrun programs
Max Noel
maxnoel_fr at yahoo.fr
Tue Jan 18 19:00:19 CET 2005
On Jan 18, 2005, at 17:52, Jack Cruzan wrote:
> Greetings!
> Ok if any of you read my earlier email you would have seen that:
> A) I am a newbie programmer.
> B) A Shadowrun gamer.
> C) In over my head making a SRCG (Shadowrun Character Generator)
> so with that in mind gave up making my python based SRCG. Instead I am
> making python Shadowrun utilities!
> The first of which was a program size and cost calculator for decker's
> utilities and skillsofts. (I always hated flipping back and forth in
> the
> book to figure it out). Thought I would let you see it and maybe
> critique? Be kind its first original program I have written. (Well
> thats
> not php or shell script).
>
Doesn't look bad. However, you should aim to repeat yourself as little
as possible, and the "The program's[...]" string is repeated 4 times.
You should delay its display until the end of the program, like that:
if rating < 4:
availability = "2/7"
cost = rating * 100
# same for other options...
# [skipping to the end of the program]
print "The program's Availability is ", availability, " days and costs
", cost
Of course, an even better way is to use string formatting in the print
line. But that's not really important.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run through my corridors... How can you challenge a
perfect, immortal machine?"
More information about the Tutor
mailing list