Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Python
Actividad 1:
1) 1) Imprimir “Hola mundo” por pantalla.
1 #!/usr/bin/python3
2
3 print("Hola mundo")
1 #!/usr/bin/python3
3 variable1 = 5
4 variable2 = 6
7
print("La suma de ",variable1,"+",variable2,"=",suma)
8
3) 3) Mostrar el precio del IVA de un producto con un valor de 100 y su precio final.
Esconder «
1 #!/usr/bin/python3
3 IVA = 0.21
1
Prof. Leticia Laura Yamin
Colegio San Patricio
5 precioProducto = 100
8
print("El precio del IVA es", precioIVA, "€")
9
10
print("El precio final es", (precioIVA+precioProducto) ,"€")
11
3 a =7
4 b =5
6 if( a<b ):
else:
8
print("B es menor que A")
9
5) 5) Crea una variable numérica y si esta entre 0 y 10, mostrar un mensaje indicándolo.
Esconder «
1 #!/usr/bin/python3
3 a =5
2
Prof. Leticia Laura Yamin
Colegio San Patricio
else:
7
print("No esta en ese rango")
8
6) 6) Añadir al anterior ejercicio, que si esta entre 11 y 20, muestre otro mensaje
diferente y si esta entre 21 y 30 otro mensaje.
Esconder «
1
#!/usr/bin/python
2
3
a = 35
4
3
Prof. Leticia Laura Yamin
Colegio San Patricio
3 i =1
5 while( i<=100 ):
print(i)
6
i+=1
7
8
print("Fin del bucle")
9
3 for i in range(1,101):
4 print(i)
4 print(i)
4
Prof. Leticia Laura Yamin
Colegio San Patricio
3 #1º forma
4 print("1 forma")
for i in range(1,101):
5
if( (i%2)==0 ):
6
print(i)
7
8
print("")
9
10
#2º forma
11
print("2 forma")
12 for i in range(2,101,2):
13 print(i)
14
5
Prof. Leticia Laura Yamin
Colegio San Patricio
6
Prof. Leticia Laura Yamin