# data[].attributes.body
2nde, 1ère spé, 1ère techno

# data[].attributes.attachment_link.description
Une interface qui permet d'exécuter du code informatique. Pour cela Jupyter s'appuie sur des programmes indépendants capablent d'interpréter le langage dans lequel est écrit ce code. Dans la terminologie de Jupyter ces interpréteurs sont appelés des noyaux ( kernel en anglais). La machine jhub.lycee-chateaubriand.fr dispose des noyaux pour les langages Python 3 et OCaml.

# data[].attributes.body
Anaconda contient Jupyter notebook

# data[].attributes.attachment_link.title
Anaconda | The World's Most Popular Data Science Platform

# data[].attributes.attachment_link.description
Anaconda is the birthplace of Python data science. We are a movement of data scientists, data-driven enterprises, and open source communities.

# data[].attributes.body
Listes : minimum

# data[].attributes.body
Listes : ordonner

# data[].attributes.attachment_link.readable_text
liste = [10,2,3,4,5,6,1,7,8]
lr=[]
def min(l):
    m=l[0]
    for i in range(len(l)):
        if l[i]<m:
            m=l[i]
    return(m)

for j in range (len(liste)):
    lr.append(min(liste))
    liste.remove(min(liste))

print(lr)

# data[].attributes.body
Listes : nombres premiers

# data[].attributes.attachment_link.readable_text
from math import *

L=[]

def premier(n):
    for i in range (1,n+1):
        if (n%i) == 0:
            L.append(i)
    if len(L) == 2:
        v = True
    else:
        v= False
    return v


K=[]

for k in range(1,101):
    L[:]=[]
    if premier(k):
        print(k)
        K.append(k)
print(K)


    

# data[].attributes.body
Listes : Exercice des lampes

# data[].attributes.attachment_link.readable_text
lampes = [1]*100
for loop in range(2, 101):
    multiple = loop-1
    while multiple <100:
        if lampes[multiple] == 0:
            lampes[multiple] = 1
        else:
            lampes[multiple] = 0
        multiple+=loop

print(lampes)

# data[].attributes.body
Simulation loi binomiale

# data[].attributes.attachment_link.readable_text
from random import*

def nbsuc(k):
    nbsuc=0
    for i in range (3):
        n=randint(1,6)
        if n==k:
            nbsuc += 1
    return nbsuc

def gain(l):
    r=nbsuc(l)
    if r==0:
        gain = -1
    else:
        if r == 1:
            gain = 2
        else:
            if r == 2:
                gain = 3
            else:
                gain = 4
    return gain
    
N=int(input("Nombre de parties :"))
S=0
for i in range(N):
    x=randint(1,6)
    S += gain(x)
print(S)

# data[].attributes.headline
Attendre la fille : loi géométrique tronquée

# data[].attributes.subject
Attendre la fille : loi géométrique tronquée

# data[].attributes.body
fichier 1

# data[].attributes.attachment_link.readable_text
from random import*

def enf():
    x=randint(1,205)
    if x<=100:
        enf='F'
    else:
        enf='G'
    return enf



def prem():
    rang=1
    x=enf()
    famille=[x]
    while x=='G' and rang<=3:
        x=enf()
        famille.append(x)
        rang=rang+1
    if x=='G':
        return 0
    else:
        return rang
    


# data[].attributes.body
fichier 2

# data[].attributes.attachment_link.readable_text
﻿from matplotlib.pyplot import *
from math import*


q=complex(3/4,-sqrt(3)/4)

def spir(n):
    z=8
    x=[z.real]
    y=[z.imag]
    for i in range(n):
        z=q*z
        x.append(z.real)
        y.append(z.imag)
    plot(x,y)
    show()

def long(n):
    z=8
    som=0
    for i in range(n):
        som=som+abs(q*z-z)
        z=q*z
    return(som)

# data[].attributes.attachment_link.readable_text
﻿from matplotlib.pyplot import *
from random import*
from math import*


def test(c,a):
    z=a
    n=0
    while abs(z)<=2 and  n<100:
        z=z**2+c
        n=n+1
    return n

def jul(c):
    for i in range(20000):
        a=complex(2-4*random(),2-4*random())
        t=test(c,a)
        if t==100:
            plot(a.real,a.imag,'x:b')
    axis('equal')
    show()



# data[].attributes.body
Complexes partie II

# data[].attributes.attachment_link.title
Dimensions - chapitre 6 : Les nombres complexes (2)

# data[].attributes.attachment_link.readable_text
﻿from matplotlib.pyplot import *
from random import*
from math import*


def test(c,a):
    z=a
    n=0
    while abs(z)<=2 and  n<100:
        z=z**2+c
        n=n+1
    return n

def mand(a):
    for i in range(20000):
        c=complex(2-4*random(),2-4*random())
        t=test(c,a)
        if t==100:
            plot(c.real,c.imag,'x:b')
    axis('equal')
    show()



# data[].attributes.body
première simulation

# data[].attributes.body
Syracuse

# data[].attributes.attachment_link.readable_text
def terme_suivant(n):
    if n % 2 == 0:
        return n/2
    else:
        return 3*n+1

def liste(d,n):
    for i in range(n):
        print(d)
        d = terme_suivant(d)
    return 

def atteint(d,r):
    B = False
    for i in range(1,r+1):
        if d == 1:
            B = True
        d = terme_suivant(d)
    return B

def temps_vol(d):
    r = 1
    while d != 1:
        d = terme_suivant(d)
        r +=1
    return r

def vol_alt(d):
    v=0
    terme_init=d
    while terme_init < terme_suivant(d):
        v += 1
        d = terme_suivant(d)
    return v

D=int(input("Premier terme :"))

N = 0
while N == 0:
    N=int(input("Entier n :"))

liste(D,N)

R=0
while R <= 0:
    R=int(input("Rang r :"))

print(atteint(D,R))

print(temps_vol(D))

print(vol_alt(D))