2 < 3
def indice_min(nombres):
indice = 0
minimum = nombres[0]
for i in range(len(nombres)):
if minimum > nombres[i]:
minimum = nombres[i]
indice = i
return indice
# test 1 : doit renvoyer 2
indice_min([2, 4, 1, 1]) == 2
# test 2 : doit renyoyer True
indice_min([5]) == 0
# tests 3 : ne doit pas renvoyer de message d'erreur
assert indice_min([2, 4, 1, 1]) == 2
# Réaliser vos propres tests :
indice_min()
print("Hello World")
Today is
import time
pyscript.write('date', time.strftime('%d/%m/%Y %H:%M:%S'))
print("Let's evaluate π :")
def eval_pi(n):
pi = 2
for i in range(1,n):
pi *= 4 * i ** 2 / (4 * i ** 2 - 1)
return pi
pi = eval_pi(100000)
s = " " * 10 + f"π is approximately {pi:.5f}"
print(s)
pyscript.write('hey', f'Hey Mate !')