Tuesday, September 23, 2008

Thank You Messages Wedding Program

3) Start: First script (already?!?)

Si possiamo benissimo iniziare a scrivere il nostro primo script ( o programma come volete voi). Iniziamo già dalla terza lezione perchè in questo blog non intendo perdere tempo sull informatica teorica qua si pratica e basta ;-). Bene iniziamo... Ok create un file di testo, potete usare quasiasi editor, scrivete:

print "hello world"

Save as prova.py . Go to the terminal position yourself on the folder where you saved the file and type python prova.py if the result is this:

bash-3.1 $ python hello world prova.py


Well you have written your first program in python (to know the history of hello world read in this page ) now is an explanation of print script screen is used to print any string, or variable, it seems obvious that in this case the string is "hello wolrd" but it could very well be "Hello mom." Remember the string must be enclosed in quotes "" otherwise we will have an error.

Exercise: Write a program that prints three strings 2 with random phrases and the center should remain empty as you do? You can write the script on the comments

0 comments:

Post a Comment