[Tutor] new on the list
tonytraductor at linguasos.org
tonytraductor at linguasos.org
Thu Feb 28 04:53:05 CET 2008
Hi,
I'm Tony. I'm a translator.
This is my first post to this list.
I've been using Linux, pretty well exclusively,
for about 8 years, but I never got under the hood
more than learning the shell basics to do
basic stuff that I needed to do, manipulating config files.
(Although I did recently make my own "distro" for translators,
but it's just a remaster of PCFluxboxOS with some changes to
the software to include some tools for translators, linguasos.org).
But, I've finally decided that I want more control
over my machine than just manipulating configs, and I want some
software that currently doesn't exist, too.
So, I've decided to learn to program.
This was in November, so, I'm very, very new to programming.
I started learning to write bash scripts in November, first,
and started learning Tcl in January (I feel like
I'm making a lot of progress with Tcl, and have
even written a program for translator project mgmt
that a number of folks are using already transprocalc.org
a very basic program, really, but tcl.tk makes
it easy to build a gui, as easy as writing html, really).
I've played a little with java, but haven't really
gotten beyond "Hello, World!", same with C.
But, ESR says if I want to be a hacker,
Python is the best place to start,
so, this week I started learning python.
I have made a couple of friends on-line, real
hackers, who have decided to help teach me.
One gave me an assignment to write a program
that would generate 5 random numbers, using a loop.
I wrote:
# Let's make a pizza.
# pizza.py
# escrito por anthony baldwin / tonytraductor at linguasos.org
from random import randint
print "I'm hungry!"
print "Let's make a nice pizza, eh!"
ing = ("pepperoni", "ham", "onions", "sausage", "bacon", "peppers", "spiders", "mozzarella", "anchovies", "chocolate chips", "dog hairs", "toe-nail clippings", "fried clams", "lollipops", "paper clips", "calamari", "m&ms", "broccoli", "gum drops", "green beans")
print "Let's make a pizza with"
for i in range(5):
p = randint(0,19) # someone told me I could have done len(ing), but I do not know what 'len' is yet.
print ing[p]
print " "
print "That's a nice pizza, eh! "
print "Mangeamos!"
The other told me that the following was used to separate the sheep
from the goats, so to speak, which I don't quite understand, since it
took me all of 10 minutes to figure it out.
He told me to write a program that would print 5 lines, like this:
*
**
***
****
*****
With a loop, and in such fashion that it could be easily extended to
continue up to any number of lines.
I thought this one was easy.
I did:
# twinkle stars python / twinkle.py
# escrito por anthony baldwin / tonytraductor at linguasos.org
t = "*"
print "Twinkle, twinkle little stars."
for i in range(5):
print t * (i+1)
print "Twinkle, twinkle..."
So.
How'd I do?
(I wrote these using a simple text editor that I made with Tcl,
too, http://www.linguasos.org/tcltext.html )
/tony
--
http://www.LinguasOS.org - Linux for Translators
http://www.BaldwinLinguas.com - translating & interpreting
http://www.TransProCalc.org - Free translation project mgmt software
More information about the Tutor
mailing list