Tuesday, September 30, 2008

Show Me Boobs Of Indian Heroines

7) Begin: if statement, elif and else

Education allows us to check if a condition is met if the condition continues else and otherwise processing a different block. Here is an example which is better:

  
# / usr / bin / python

name = raw_input ( What's your name? )
if name == " plaoo " : # check if name and 'equal to "plaoo"
print " Bravooo " # if the condition and' respected print to video "Bravooo"
else : # If the condition is not met
print "Your name is " + name # print to video "Your name is" + the string variable name

As you can see there are spaces after else if and this is called indentation. In python E ' you can use 4 spaces required or (as I do io) un TAB . Se usate TAB ricordatevi che l'istruzione non sarà eseguita . Con i 4 spazi, invece, restituisce l'errore se l'identazione è sbagliata.

Spieghiamo meglio, if nome == "plaoo" : se nome è uguale (==) a "plaoo" se è così allora stampa "bravooo"
else altrimenti stampa "ti chiami" + il valore di nome.
L'istruzione if ha bisogno di operatori di confronto come == nell' esempio precedente e questi sono quelli uttilizzati:
  
< minore di
> maggiore di
==
equal to or less <=
> = \u200b\u200bgreater than or equal to
! =
other


another example with variables Numeric:
  
# / usr / bin / python
numero_magico = 8
number = input ( Pick a number from 0 to 10: )
if numero_magico == number :
print "Congratulations you have guessed the number "
elif number > numero_magico :
print "Too high "
elif number < numero_magico :
print "Too low "


What's happening? After creating the variable numero_magico user is prompted to choose a number if numero_magico ( if numero_magico ) is equal (== ) to number Press a video "Complimenti hai indovinato il numero" ( print "Complimenti hai indovinato il numero" )
altrimenti se numero ( elif numero )è maggiore ( > ) di numero_magico stampa a video "Troppo alto" ( print "Troppo alto" )
altrimenti se numero( elif numero ) è troppo basso ( < ) di numero_magico stampa a video "Troppo basso" ( print "Troppo basso" ). Possiamo usare tutti gli elif che vogliamo per avere il controllo delle variabili.
elif viene usato come if , cioè può fare un confronto con le condizioni else instead is used when none of the comparisons with the conditions.

* * TO REMEMBER: Use
indentation which would be spaces after if, elif and else.
All statements must end with ":"

Sunday, September 28, 2008

Pathophysiology Polyps

6) start: Keyboard Input

For keyboard input is meant, of course, the keys are pressed on the keyboard. The python has two instructions that allow us this raw_input () and input (). raw_input used in this way:

string = raw_input (" write here: ) # everything verra scritto sarà la variabile stringa

Un altra cosa interessante è che raw_input() ti permette di stampare a video una stringa ("scrivi qua:) da ricordare che bisogna mettere tutto tra parentesi. input() funziona allo stesso modo:

numero = input (" scrivi qua: ")

Funziona esattamente come come raw_input() . E allora perchè usare due istruzioni se compiono lo stesso compito?? In realtà raw_input() crea variabili di tipo stringa mentre input() variabili intere (o numeriche). Come abbiamo visto nella precedente lezione le variabili stringa e le variabili numeriche sono incompatibili tra loro dovete stare molto attenti quando usate queste due istruzioni o vi capiterà molto spesso di avere errori.

Esempi pratici:

#!/usr/bin/python
nome = raw_input (" Come ti chiami?? ") #procedura per creare la variabile nome
anni = input ("quanti anni hai?? ") #crea la variabile anni che è un intero
print nome #stampa a video la variabile nome
print anni #stampa a video la variabile anni

ecco l' output:
   Come ti chiami?? 
Plaoo
23
Che succede?? Semplicissimo ad ogni istruzione che sia raw_input() o input() il programma si blocca e attende l'input da tastiera che poi va a stampare a video con le instruzioni print nome e print anni.

Per scoprire che tipo di variabile abbiamo possiamo usare type() . type() ci fa vedere il di tipo variabile che stiamo analizzando in questo modo:

name = raw_input (" What's your name? ) # procedure to create the variable name
type ( name ) # check what kind of variable We
print name

the output is this:

What's your name?
\u0026lt;type'str'>
Plaoo

What's happening? the first and the last one, but we know what that \u0026lt;type'str'>? In Here type () returns us the type of variable in this case 'str' because it is otherwise, it returns a string if it were an integer.

Exercise: Create a program after a series of questions create a profile of a person looking to also use the string concatenation


Wednesday, September 24, 2008

Old Man Breastfeeding

5) Start: Numeric variables (starts a little math)

as string variables, numeric variables can also change the their value during the execution of the program, even MUCH more, given that we use for mathematical purposes (of course being numbers). Numeric variables declared in the same way as string

num = 1

Da notare che non usiamo gli apici "" altrimenti il python la riconoscerebbe come una stringa, è possibile applicare solamente l' operatore matematico * , tutti gli altri operatori creano errori tra i due tipi di variabili se provassimo a fare un programma del genere:

num = 1
fra = "ciao"
print num + fra

questo sarà il risultato:

Traceback (most recent call last):
File " ", line 1, in
TypeError: unsupported operand type (s) for +: 'int' and 'str'

Just because there are two different variables. Numerical variables we can apply the mathematical operators in python are these:
  +  
ADDITION - SUBTRACTION
/ DIVISION
* REPRODUCTIVE
** Exponentiation

Try a few simple steps:

num = 3 # declare numeric variable with a value of 2
num2 = # 2 ditto of course with a name different
print num - num2 # print out your results

What's happening? In this case there is a simple subtraction num (with a value of 3) - num2 (with value 2) prints the result 1.

diachiarare We can use variables for the operation this way:

num = 3 # declare numeric variable with a value of 2
num2 = # 2 ditto of course with a different name
risu = num - num2 # Variables that includes the operation and the result becomes the same
print risu # print the variable video risu

What's happening? in this case we used another variable to make it the result of 'operation itself so that we can use the result for other purposes, simply call the variable risu and work on it another operation, eg

num = 3 # declare numeric variable with a value of 2

num2 = 2 # ditto obviously with a different name
risu = num - num2 #questa varibile racchiude l'operazione e diventa il risultato stesso
print risu #stampa a video la variabile risu

risu = risu * 5
#usiamo la variabile risu per applicarle un altra operazione risu * 5 moltiplichiamo risu per 5 volte
print risu #stampa a video il risultato

Che succede?? Dopo che stampiamo a video il risultato della sottrazione num - num2 lo stesso risulato che adesso è risu lo moltiplichiamo per 5 e stampiamo a video il risultato a questo punto risu a valore 5 e non più il risultato della sottrazione precedente.

Come in matematica l'uso delle parentesi ( ) ha precedenza rispetto a tutto il resto vediamo un esempio:

num = 4
num2 = 2
risu = ( num + num2 ) * 2
print risu

Che succede?? In questo caso l'operazione racchiusa tra parentesi ha la precedenza sulla moltiplicazione (come in matematica)

Tips & Tricks: try to create a string variable and multiply it by 2!

Exercise:
1) Create a program using all the addresses on less variables as possible.
2) Create a program to calculate the mathematical average.

Quickbooks Premier Product Number

4) Here we go: The string variables

To varying means, a portion of memory that can be changed during program execution. It's that simple! If we wanted to create a string variable just write

string = "hello world" # The variable becomes a string
print string # print-screen the string

What's happening? print, as we saw in the previous lesson, press the screen in this case the variable contains a string and we just read the string. We said that the variables can be changed during program execution so if you write well?

string = "hello world" # variable has the value "hello world" string
= "Hello World" here instead becomes # hello world "
print string

What's happening? In this case, the string variable value change at the beginning is "hello world" in the line next sequence becomes "Hello World". If you do a test print you will find that video print "Hello World" becomes the ultimate value that the variable string. You can assign any name to the variable except those reserved to python:

else for continuous and not raise import

assert def except from in or return
global break exec is try
class pass elif if finally lambda print while

How to concatenate variables: If we wanted to join
2 o più variabili potremi usare il simbolo " + " in questo modo:

stringa = "Hello " #da notare lo spazio lasciato alla fine prima dell apice
stringa2 = "world"
print stringa + stringa2

in questo caso output (il risolutato che ne consegue) sarà questo:

Hello world

Per fare delle prove (e vi consiglio di farne tante per restarvi in mente) usate il metodo usato nella lezione precedente create un file chiamato prova.py e fatelo eseguire dal terminale con python prova.py

Che sono quelle frasi dietro # ?? Si tratta di un commento, potete scrivere i vostri commenti a fianco al codice in modo tale da prendere appunti su quello che fà il programma sono utilissimi e vi consiglio di utilizzarli il più possibile.

Esercizio: Create 3 variabili che concatenate formino una frase di senso compiuto

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

Monday, September 22, 2008

Zinc And Castor Oil Cream

2) Start: Where to find the 'python interpreter

If you use a Linux distribution to 90% is already installed walk- open the terminal and enter the command python if the result is this:

bash-3.1 $ python

Python 2.5.2 (r252: 60911, Mar 1 2008, 13:52:45)
[GCC 4.2.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

type:
>> exit () to exit


If you can do whatever peace of mind that your python is already installed otherwise you can find it in the repository of your distribution

If you use a system Microsoft Windows http://www.python.org/download/ go on to download the 'installer. On the site
python.org you can also find sources of 'interpreter.

Stouffers Outlet Solon Ohio Phone Number

1) Start: What is python?

The python is a language interpreted programming. Interpreted means that after you create the program need not be completed because the 'interpreter "reads" the code as written. example source code
----- ----- interpreter python> program execution
The cool thing about it is that the Python interpreter has a huge portability you can use it on your mobile phone (Symbian OS) on Windows, Linux, Mac etc etc. In short, you can use python really everywhere, the simplicity of this language is the state 's work, and this blog will teach you a simple to use all the capabilities of python.