Programas Con Python
Programas Con Python
l1 = [1,2,3,2,4]
l2=list(range(2,9,3))
print (l2)
print(len(l1))
print (l1)
l1.append(-2)
print (l1)
l1.count(3)
print (l1.count(2))
l1.insert(0, 1000)
print (l1)
l1.insert(3, 1000)
print (l1)
l1.sort()
print (l1)
l1.reverse()
print (l1)
print(len(l1))
l1.clear()
print (l1)
l3 =[0.0 for i in range(6)]
print (l3)
l3=[]
for i in range(3):
nota=float(input("Digite la nota: "))
l3.append(nota)
print (l3)
código python:
# script.py
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<py-script>
def cambiar_texto(event):
elemento = document.getElementById("mensaje")
if elemento:
else:
# Inicializar evento
def inicializar():
boton = document.getElementById("cambiar")
if boton:
callback_proxy = create_proxy(cambiar_texto) # Crea un proxy para la
función
else:
inicializar()
</py-script>
</body>
</html>
f=open('datos1.txt','w')
r='Matemáticas\n'
f.write(r)
r='Física\n'
f.write(r)
r='Química\n'
f.write(r)
f.close()
while True:
try:
arch=open(nombre+'.txt','r')
except FileNotFoundError:
if crear=='1':
arch=open(nombre+'.txt','w')
else:
continue
break
"""
Spyder Editor
"""
while True:
try:
arch=open(nombre+'.txt','r')
linea=arch.readline()
linea=arch.readline()
linea=arch.readline()
linea=arch.readline()
print(linea)
arch.close()
except FileNotFoundError:
if crear=='1':
arch=open(nombre+'.txt','w')
else:
continue
break
"""
f=open('datos1.txt','r')
r=f.readline()
print(r)
r=f.readline()
print(r)
r=f.readline()
print(r)
r=f.readline()
print(r)
r=f.readline()
print(r)
r=f.readline()
print(r)
r=f.readline()
print(r)
f.close()
"""
"""
f=open('datos1.txt','w')
r='Matemáticas\n'
f.write(r)
r='Física\n'
f.write(r)
r='Química\n'
f.write(r)
r='Programación Básico\n'
f.write(r)
f.close()
"""