Introducción A Python
Introducción A Python
https://www.youtube.com/watch?v=7vbi-OCFZEY
>>> introduction to Python
+
>>> introduction to Python
#Programa per calcular el major numero
num1 = 18
num2 = 14
num3 = 12
print ("El mayor numero entre " + str(num1) + ", " + str(num2) + " y " + str(num3) + " es "
+ str(mayor))
>>> print (“learning python”);
Read them!
Suma = 5 + 2
Resta = 80 - 29
Multiplicación = 33 * 2
División = 40 / 3
Modulo (resto división) = 3 % 2
Potencia = 2 ** 5
>>> print (“learning python”);
>>> print (“learning python”);
side = 2
area = side * side
print (area)
>>> print (“learning python”);
this_is_a_normal_name = 7
this_also2 = 7
x=7
print(x)
x = “yuhu”
print(x) (the last value)
>>> print (“learning python”);
nombre = "Aina"
edad = "35"
comida = "brownie"
message = “””Message
in three
lines”””
print (message)
>>> print (“learning python”);
primera_letra = “AINA”[0]
“hello” + “world”
‘hello’ * 3
‘My name is “Aina”’
>>> print (“learning python”);
len(“hola”) longitud
HOLA.lower() minúsculas
hola.upper() mayúsculas
str(2) convertir nº a String
x = "J123"; x.isalpha() ¿solo caracteres?”
>>> print (“learning python”);
print("Despa" + 'cito')
print(“2” + “2”)
nombre = “Alberto”
print “Hola” %s” % (nombre)
>>> print (“learning python”);
print("""Hello,
How are you?""")
>>> print (“learning python”);
len(str(304023))
>>> print (“learning python”);