This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html | |
import Svg exposing (..) | |
import Svg.Attributes exposing (..) | |
import Graphics.Element exposing (show) | |
import Dict | |
empty = {nodes = Dict.empty, nodeData = Dict.empty, edgeData = Dict.empty} | |
emptyNode = {from = [], to = []} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=0 | |
ch=input("indiquez votre année : ") | |
a=float(ch) | |
if (a%4==0) & (a%100!=0): | |
print("l'année est bissextile") | |
elif a%400==0: | |
print("l'année est quand meme bissextile") | |
else: | |
print("perdu,cette année n'est pas bissextile") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Graphics.Collage exposing (..) | |
import Graphics.Element exposing (..) | |
import Graphics.Input exposing (..) | |
import Color exposing (..) | |
import Signal exposing (..) | |
import Text | |
import List | |
import Mouse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Counter where | |
import Array | |
import Graphics.Element exposing (..) | |
import Graphics.Collage exposing (..) | |
import Color exposing (..) | |
import Mouse | |
-- MODEL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Le but est de trouver tous les nombres premiers entre 1 et 1000 | |
# On va éliminer au fur et à mesure les nombres quand on leur trouve des diviseurs autres que 1 et eux mêmes. | |
# On construit une liste a. Le but est que le ième élément de cette liste vale True si i est premier et False sinon | |
a=[True]*1000 | |
# être un "multiple de 0" ne veut rien dire. être un multiple de 1 ne veut pas dire que le nombre n'est pas premier. | |
# Donc on va commencer à chercher les multiples à partir de 2. | |
# Un nombre i > sqrt(1000) ne peut pas être un multiple d'un nombre e tel que e < 1000, donc on peut s'arrêter de chercher des multiples au dessus sqrt(1000) | |
from math import sqrt | |
for i in range(2,int(sqrt(len(a)))): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
import Data.Char | |
import System.IO | |
data Formula = Operation Char [Formula] | Variable String | Constant Float deriving Show | |
opAdd = Operation '+' | |
opMul = Operation '*' | |
toFormula :: Sch -> Formula | |
toFormula (And l) = opMul $ map toFormula l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sqlite3 | |
conn = sqlite3.connect(":memory:"); | |
cur = conn.cursor() | |
cur.execute("CREATE TABLE IF NOT EXISTS nums(n INTEGER PRIMARY KEY)"); | |
cur.executemany("INSERT INTO nums VALUES (?)", ((i,) for i in range(1,1000))); | |
cur.execute("DELETE FROM nums WHERE (SELECT COUNT(n2.n)>2 FROM nums AS n2 WHERE nums.n%n2.n=0)"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
fichierExo1="test.sq3" | |
conn=sqlite3.connect(fichierExo1) | |
cur=conn.cursor() | |
cur.execute("CREATE TABLE compo (comp TEXT,a_naiss INTEGER, a_mort INTEGER)") | |
cur.execute("CREATE TABLE oeuvres2 (comp TEXT, titre TEXT, duree INTEGER, interpr TEXT)") | |
data=[("Mozart",1756,1791),("Beethoven",1770,1827),("Haendel",1685,1759),("Schubert",1797,1828),("Chopin",1810,1849),("Vivaldi",1678,1741),("Monteverdi",1567,1643), | |
("Bach",1685,1750),("Shostakovich",1906,1975)] | |
for i in data: #parcours des tuples |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Non-recursive definition | |
function ack(m,n) { | |
var ans, mn, pile; | |
for (pile=[[m,n]]; mn = pile.pop();) { | |
var m = mn[0], n = mn[1]; | |
if (n === -1) n = ans; | |
if (m === 0) ans = n + 1; | |
else if (n === 0) pile.push([m-1, 1]); | |
else { | |
pile.push([m-1, -1], [m, n-1]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% On organise un grand jeu. Il y a dix équipes, et neuf tables. À chaque tour de jeu, | |
% chaque table peut être soit occuppée, soit vide. Si elle est occuppée, alors deux équipes | |
% différentes s'y affrontent. À la fin du jeu, il faut que toutes les équipes se soient rencontrées, | |
% et que chacune soit passée par chaque table. Le but est d'organiser le jeu pour faire le | |
% moins de tours possible. | |
equipe(1..10). | |
table(1..9). | |
tour(1..20). | |
% On ne peut pas être à deux tables en même temps |