<script type="text/javascript"> Click para ver el resultado
Variables •
Números, Números, Strings, Booleanas
<script type="text/javascript">
Alcance <script type="text/javascript">
Palabras reservadas Absstr Ab tract act boo boole lean an br brea eakk byte byte case cas e catc catch h char clas classs cons constt continu cont inue e deb debugg ugger er def default ault del delete ete do doubl do ublé é else else en enum um exp xpor ortt ext xten ends ds false final finall finallyy float fo forr funct fu nctio ion n go goto to if im impl plem emen ents ts im impor portt in Ins Insta tance nceof of int inte interf rface ace long
Palabras reservadas •
•
•
•
•
•
•
•
native nati ve ne new w null null package pack age pri privvate pr prote otecte cted d whil while e publi pub licc ret etur urn n sh shor ortt wi with th stati aticc su supe perr sw swit itch ch synchr synchronize onized d this thr throw vola volati tille throws thr ows tr trans ansien ientt tru true e try typ typeof eof voi void d
Lenguajes de Programación Python M.C Said Zamora
Compilador online •
http://pythonspot.com/run.php
•
http://codepad.org/
•
http://www.codeskulptor.org/
Mensajes y números •
•
•
•
•
•
•
print("Hel print("Hello lo Hi!") x=3 f = 3.1415926 name = "Python“ big = 358315791L z = complex( co mplex(2,3) 2,3)
Operadores •
Aritmeticos: + * / -
•
Relacionales: = , ==
Entrada •
x = int(raw_input int(raw_input(“Introduz Introduzca ca x:"))
•
y = int(raw_input(“Introduzc Introduzca a y:"))
•
•
sum = x + y
•
print(sum)
Strings •
s = "Hello Python"
•
print(s)
•
print(s[0])
•
print(s[1])
•
print(s[2:4])
•
print(s[6:])
Listas •
•
• •
•
•
•
l = [ "Derpina", "Derp", "Derpette" "Derpette" ] pri print l prin printt l[0] l[0] prin printt l[1] l[1] l.append("") l.remove("") l.sort() l.reverse()