QCM C1
This commit is contained in:
parent
3ad9ff1140
commit
eb3c7313c5
199 changed files with 10833 additions and 0 deletions
2976
C2/c2.html
Normal file
2976
C2/c2.html
Normal file
File diff suppressed because it is too large
Load diff
BIN
C2/c2_fichiers/bns_4.jpg
Normal file
BIN
C2/c2_fichiers/bns_4.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
99
C2/c2_fichiers/github.css
Normal file
99
C2/c2_fichiers/github.css
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
|
||||
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
|
||||
|
||||
*/
|
||||
|
||||
.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
color: #333;
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.hljs-comment,
|
||||
.hljs-quote {
|
||||
color: #998;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-selector-tag,
|
||||
.hljs-subst {
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-number,
|
||||
.hljs-literal,
|
||||
.hljs-variable,
|
||||
.hljs-template-variable,
|
||||
.hljs-tag .hljs-attr {
|
||||
color: #008080;
|
||||
}
|
||||
|
||||
.hljs-string,
|
||||
.hljs-doctag {
|
||||
color: #d14;
|
||||
}
|
||||
|
||||
.hljs-title,
|
||||
.hljs-section,
|
||||
.hljs-selector-id {
|
||||
color: #900;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-subst {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.hljs-type,
|
||||
.hljs-class .hljs-title {
|
||||
color: #458;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-tag,
|
||||
.hljs-name,
|
||||
.hljs-attribute {
|
||||
color: #000080;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.hljs-regexp,
|
||||
.hljs-link {
|
||||
color: #009926;
|
||||
}
|
||||
|
||||
.hljs-symbol,
|
||||
.hljs-bullet {
|
||||
color: #990073;
|
||||
}
|
||||
|
||||
.hljs-built_in,
|
||||
.hljs-builtin-name {
|
||||
color: #0086b3;
|
||||
}
|
||||
|
||||
.hljs-meta {
|
||||
color: #999;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-deletion {
|
||||
background: #fdd;
|
||||
}
|
||||
|
||||
.hljs-addition {
|
||||
background: #dfd;
|
||||
}
|
||||
|
||||
.hljs-emphasis {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
667
C2/c2_fichiers/highlight.pack.js
Normal file
667
C2/c2_fichiers/highlight.pack.js
Normal file
File diff suppressed because one or more lines are too long
1
C2/c2_fichiers/menu.svg
Normal file
1
C2/c2_fichiers/menu.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#FFFFFF"><path d="M0 0h24v24H0z" fill="none"/><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>
|
||||
|
After Width: | Height: | Size: 202 B |
30
C2/c2_fichiers/script.js
Normal file
30
C2/c2_fichiers/script.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
const menu = document.querySelector("header nav img")
|
||||
const aside = document.querySelector("aside")
|
||||
const content = document.querySelector(".content")
|
||||
|
||||
let toggle = false;
|
||||
|
||||
menu.addEventListener('click', () => {
|
||||
toggle = !toggle
|
||||
console.log('clic')
|
||||
if (toggle) {
|
||||
aside.classList.add('show_aside')
|
||||
aside.classList.remove('hidden_aside')
|
||||
} else {
|
||||
aside.classList.add('hidden_aside')
|
||||
aside.classList.remove('show_aside')
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
if (content != null) {
|
||||
content.addEventListener('click', () => {
|
||||
if (toggle) {
|
||||
toggle = false
|
||||
aside.classList.add('hidden_aside')
|
||||
aside.classList.remove('show_aside')
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
338
C2/c2_fichiers/style.css
Normal file
338
C2/c2_fichiers/style.css
Normal file
|
|
@ -0,0 +1,338 @@
|
|||
@font-face {
|
||||
font-family: "input";
|
||||
src: url("fonts/InputMonoNarrow-Light.ttf");
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: Helvetica, Georgia, sans-serif;
|
||||
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: rgb(255, 255, 255);
|
||||
}
|
||||
|
||||
/*************************************header+aside****************************************/
|
||||
header {
|
||||
background-color: #424242;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
color: white;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
header nav {
|
||||
margin-left: 40px;
|
||||
width: 10%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
list-style: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@media (max-width:800px) {
|
||||
header h2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
header h3 {
|
||||
font-size: 1rem;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
header nav {
|
||||
width: 50%
|
||||
}
|
||||
}
|
||||
|
||||
header nav img {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
header h2 {
|
||||
margin-right: 40px;
|
||||
}
|
||||
|
||||
@media (max-width:800px) {
|
||||
.content {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
aside {
|
||||
position: fixed;
|
||||
top: 60px;
|
||||
left: -300px;
|
||||
width: 300px;
|
||||
background-color: rgba(7, 7, 7, 0.8);
|
||||
list-style: none;
|
||||
height: 100vh;
|
||||
overflow-y: scroll;
|
||||
list-style: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
aside>ul {
|
||||
padding-top: 30px;
|
||||
padding-bottom: 70px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
aside ul {
|
||||
list-style: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
aside ul li ul {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
aside a {
|
||||
display: inline-block;
|
||||
color: rgb(200, 200, 200);
|
||||
margin: 5px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
aside::-webkit-scrollbar {
|
||||
background: #000;
|
||||
width: 10px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
aside:hover::-webkit-scrollbar {
|
||||
display: block;
|
||||
}
|
||||
|
||||
aside::-webkit-scrollbar-thumb {
|
||||
background-color: #838383;
|
||||
}
|
||||
|
||||
aside::-webkit-scrollbar-thumb:hover {
|
||||
background-color: #bbbbbb;
|
||||
}
|
||||
|
||||
aside ul li a:hover {
|
||||
color: rgb(110, 110, 110);
|
||||
}
|
||||
|
||||
.show_aside {
|
||||
transform: translateX(300px);
|
||||
transition-property: transform;
|
||||
transition-duration: 1s;
|
||||
}
|
||||
|
||||
.hidden_aside {
|
||||
transform: translateX(0px);
|
||||
transition-property: transform;
|
||||
transition-duration: 1s;
|
||||
}
|
||||
|
||||
/*********************fin header+aside***********************************/
|
||||
|
||||
/***********************content**************************************/
|
||||
.content_title {
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.content_title h1 {
|
||||
|
||||
color: black;
|
||||
text-transform: uppercase;
|
||||
font-size: 5rem;
|
||||
letter-spacing: 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.content_title h2 {
|
||||
margin-top: 10px;
|
||||
color: black;
|
||||
font-size: 2rem;
|
||||
letter-spacing: 0.4rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width:800px) {
|
||||
.content_title h2 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.content_title h1 {
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 60%;
|
||||
margin: 0 auto;
|
||||
padding-top: 100px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
@media (max-width:1200px) {
|
||||
.content {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:900px) {
|
||||
.content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.content img {
|
||||
height: auto;
|
||||
max-width: 500px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:600px) {
|
||||
.content img {
|
||||
height: auto;
|
||||
max-width: 320px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:420px) {
|
||||
.content img {
|
||||
height: auto;
|
||||
max-width: 220px;
|
||||
}
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.content h1 {
|
||||
font-size: 1.5rem;
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.content h2 {
|
||||
font-size: 1.2rem;
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.content h3 {
|
||||
font-size: 1.1rem;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
margin-left: 35px;
|
||||
}
|
||||
|
||||
.content h4 {
|
||||
font-size: 1rem;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
margin-left: 43px;
|
||||
}
|
||||
|
||||
.content p {
|
||||
font-size: 1.0rem;
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
margin-left: 50px;
|
||||
margin-right: 50px;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
.content ul,
|
||||
.content ol {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
margin-left: 50px;
|
||||
margin-right: 50px;
|
||||
}
|
||||
|
||||
.content li {
|
||||
font-size: 1.0rem;
|
||||
margin-bottom: 5px;
|
||||
margin-top: 5px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.content li p {
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.content ul li ul li {
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.content img {
|
||||
margin-left: 30px;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.content table {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
border-collapse: collapse;
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.content table td {
|
||||
border: 1px solid #000;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.content table tr:nth-child(even) {
|
||||
background-color: #d1d1d1;
|
||||
}
|
||||
|
||||
.content table th {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 12px;
|
||||
text-align: center;
|
||||
background-color: #6b6b6b;
|
||||
color: white;
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
.content table caption {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.content pre {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
margin-left: 35px;
|
||||
margin-right: 35px;
|
||||
padding: 5px;
|
||||
border: 1px solid rgb(173, 173, 173);
|
||||
}
|
||||
|
||||
.content pre code {
|
||||
font-family: "input";
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.content hr {
|
||||
width: 30%;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.ok:hover {
|
||||
color: rgb(0, 255, 0);
|
||||
}
|
||||
9
C2/codes/q100_86.py
Normal file
9
C2/codes/q100_86.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
def maxi(t):
|
||||
m = t[0]
|
||||
for x in t:
|
||||
if x[1] >= m[1]:
|
||||
m = x
|
||||
return m
|
||||
|
||||
L = [('Alice', 17), ('Barnabé', 17),('Casimir', 17),
|
||||
('Doriane', 17),('Emilien', 14), ('Fabienne', 16)]
|
||||
3
C2/codes/q101_87.py
Normal file
3
C2/codes/q101_87.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
course = [(5,['Mistral','Lille']),
|
||||
(3,['Zéphir','Paris']),(7,['Ouragan','Bordeaux']),
|
||||
......, ....... ]
|
||||
9
C2/codes/q102_88.py
Normal file
9
C2/codes/q102_88.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
t1 = [['Valenciennes', 24],['Lille', 23],['Laon',
|
||||
31],['Arras', 18]]
|
||||
t2 = [['Lille', 62],['Arras', 53],['Valenciennes',
|
||||
67],['Laon', 48]]
|
||||
|
||||
for i in range(len(t1)):
|
||||
for v in t2:
|
||||
if v[0] == t1[i][0]:
|
||||
t1[i].append(v[1])
|
||||
6
C2/codes/q103_89.py
Normal file
6
C2/codes/q103_89.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def extreme(t, test):
|
||||
m = t[0]
|
||||
for x in t:
|
||||
if test(x,m):
|
||||
m = x
|
||||
return m
|
||||
2
C2/codes/q103_90.py
Normal file
2
C2/codes/q103_90.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
L = [('Alice', 17), ('Barnabé', 18),('Casimir', 17),
|
||||
('Doriane', 20),('Emilien', 15), ('Fabienne', 16)]
|
||||
2
C2/codes/q104_95.py
Normal file
2
C2/codes/q104_95.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
clients = [("Dupont", "Paul", 1),("Durand", "Jacques",
|
||||
2),("Dutronc", "Jean", 3),...]
|
||||
4
C2/codes/q104_96.py
Normal file
4
C2/codes/q104_96.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
x = []
|
||||
for i in range(len(clients)):
|
||||
if clients[i][1] == "Jean":
|
||||
x = clients[i]
|
||||
6
C2/codes/q105_97.py
Normal file
6
C2/codes/q105_97.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
t = [[3,4,5,1],[33,6,1,2]]
|
||||
x = t[0][0]
|
||||
for i in range(len(t)):
|
||||
for j in range(len(t[i])):
|
||||
if x < t[i][j]:
|
||||
x = t[i][j]
|
||||
4
C2/codes/q106_98.py
Normal file
4
C2/codes/q106_98.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
table = [12, 43, 6, 22, 37]
|
||||
for i in range(len(table) - 1):
|
||||
if table[i] > table[i+1]:
|
||||
table[i],table[i+1] = table[i+1], table[i]
|
||||
1
C2/codes/q109_99.py
Normal file
1
C2/codes/q109_99.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
x = [ "x1", "x2", "x3" ]
|
||||
6
C2/codes/q11_8.py
Normal file
6
C2/codes/q11_8.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# n et p sont initialisés dans les lignes précédentes
|
||||
|
||||
t = [ [ 0 for j in range(p) ] for i in range(n) ]
|
||||
|
||||
for k in range(n*p):
|
||||
t[k%n][k%p] = k
|
||||
5
C2/codes/q13_9.py
Normal file
5
C2/codes/q13_9.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
A = [ [1,2,3], [4,5,6], [7,8,9] ]
|
||||
B = [ [0,0,0], [0,0,0], [0,0,0] ]
|
||||
for i in range(3):
|
||||
for j in range(3):
|
||||
B[i][j] = A[j][i]
|
||||
3
C2/codes/q14_10.py
Normal file
3
C2/codes/q14_10.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
alphabet = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
||||
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
'U', 'V', 'W', 'X', 'Y', 'Z' ]
|
||||
2
C2/codes/q16_11.py
Normal file
2
C2/codes/q16_11.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
t = [0, 3, 5, 7, 9]
|
||||
t[9] = 3 + t[5]
|
||||
1
C2/codes/q17_12.py
Normal file
1
C2/codes/q17_12.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
resultat = [ i*2 for i in range(10) ]
|
||||
5
C2/codes/q18_13.py
Normal file
5
C2/codes/q18_13.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def somme(tab):
|
||||
s = 0
|
||||
for i in range(len(tab)):
|
||||
......
|
||||
return s
|
||||
6
C2/codes/q19_14.py
Normal file
6
C2/codes/q19_14.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
m = []
|
||||
for i in range(5):
|
||||
n = []
|
||||
for j in range(3):
|
||||
n.append(i*j)
|
||||
m.append(n)
|
||||
3
C2/codes/q1_1.py
Normal file
3
C2/codes/q1_1.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
n = 5
|
||||
p = 3
|
||||
t = [ [ …… for j in range(p) ] for i in range(n) ]
|
||||
4
C2/codes/q20_15.py
Normal file
4
C2/codes/q20_15.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
def feed(t):
|
||||
for i in range(len(t)):
|
||||
t[i] = 0
|
||||
return t
|
||||
6
C2/codes/q21_16.py
Normal file
6
C2/codes/q21_16.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def f(L):
|
||||
m = L[0]
|
||||
for x in L:
|
||||
if x > m:
|
||||
m = x
|
||||
return m
|
||||
2
C2/codes/q22_17.py
Normal file
2
C2/codes/q22_17.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
t = [1, 6, 8, 3, 21]
|
||||
u = [x for x in t if x > 3]
|
||||
2
C2/codes/q23_18.py
Normal file
2
C2/codes/q23_18.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
t = [1,2,3,4,5,6,7,8,9]
|
||||
v = [c for c in t if c%3 == 0]
|
||||
8
C2/codes/q28_19.py
Normal file
8
C2/codes/q28_19.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
def construitTable(L,C):
|
||||
t = []
|
||||
for i in range(L):
|
||||
ligne = []
|
||||
for j in range(C):
|
||||
......
|
||||
t.append(ligne)
|
||||
return t
|
||||
4
C2/codes/q29_20.py
Normal file
4
C2/codes/q29_20.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
def f(n1,n2):
|
||||
etendue = max(n1,n2)-min(n1,n2)
|
||||
moyenne = (n1+n2)/2
|
||||
return etendue,moyenne
|
||||
2
C2/codes/q2_2.py
Normal file
2
C2/codes/q2_2.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
t = [2, 8, 9, 2]
|
||||
t[2] = t[2] + 5
|
||||
5
C2/codes/q33_21.py
Normal file
5
C2/codes/q33_21.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
G =[[0, 0, 0, …, 0],
|
||||
[0, 0, 0, …, 0],
|
||||
[0, 0, 0, …, 0]
|
||||
….
|
||||
[0, 0, 0, …, 0]]
|
||||
2
C2/codes/q35_22.py
Normal file
2
C2/codes/q35_22.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
tab = [ ('Léa', 14), ('Guillaume', 12), ('Anthony', 16),
|
||||
('Anne', 15) ]
|
||||
1
C2/codes/q37_23.py
Normal file
1
C2/codes/q37_23.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
t = [ [1,2,3,4], [5,6,7,8], [9,10,11,12] ]
|
||||
9
C2/codes/q3_3.py
Normal file
9
C2/codes/q3_3.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
annee2019 = [('janvier',6), ('février',6), ('mars',12),
|
||||
('avril',20), ('mai',23), ('juin',25),
|
||||
('juillet',29), ('août',25), ('septembre',22),
|
||||
('octobre',15), ('novembre',11), ('décembre',7)]
|
||||
|
||||
m = annee2019[0][1]
|
||||
for mois in annee2019:
|
||||
if (m > mois[1]):
|
||||
m = mois[1]
|
||||
2
C2/codes/q42_24.py
Normal file
2
C2/codes/q42_24.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
T = [[1,2,3,4,5], [6,7,8,9,10], [11,12,13,14,15],
|
||||
[16,17,18,19,20]].
|
||||
1
C2/codes/q44_25.py
Normal file
1
C2/codes/q44_25.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
[[0,0,0,0], [1,1,1,1], [2,2,2,2]]
|
||||
2
C2/codes/q45_26.py
Normal file
2
C2/codes/q45_26.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
notes = [('Toto', 20), ('John', 12), ('Johnny', 2),
|
||||
('Superman', 16)]
|
||||
1
C2/codes/q47_27.py
Normal file
1
C2/codes/q47_27.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
M = [ [i*j for j in range(4)] for i in range(4) ]
|
||||
3
C2/codes/q49_28.py
Normal file
3
C2/codes/q49_28.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
tab=[['A', 'B', 'C', 'D'],
|
||||
['E', 'F', 'G', 'H'],
|
||||
['I', 'J', 'K', 'L'] ]
|
||||
3
C2/codes/q49_29.py
Normal file
3
C2/codes/q49_29.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# à la fin, on a l'égalité :
|
||||
L == [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
||||
'K', 'L' ]
|
||||
8
C2/codes/q52_34.py
Normal file
8
C2/codes/q52_34.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
def divEuclid(n,d):
|
||||
'''renvoie le couple formé du quotient et du reste dans la
|
||||
division de n par d'''
|
||||
q = 0
|
||||
while n-d > 0:
|
||||
q = q + 1
|
||||
n = n - d
|
||||
.......
|
||||
1
C2/codes/q52_35.py
Normal file
1
C2/codes/q52_35.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
(quotient,reste) = divEuclid(15,6)
|
||||
2
C2/codes/q55_36.py
Normal file
2
C2/codes/q55_36.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
tableau = [5,8,6,9]
|
||||
a = tableau[2]
|
||||
4
C2/codes/q59_37.py
Normal file
4
C2/codes/q59_37.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
res = [ [1,2,3], [4,5,6], [7,8,9] ]
|
||||
S = 0
|
||||
for i in range(3):
|
||||
S = S + res[i][2]
|
||||
2
C2/codes/q5_4.py
Normal file
2
C2/codes/q5_4.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
t = (10,6,1,12,15)
|
||||
r = t[3] - t[1]
|
||||
3
C2/codes/q60_38.py
Normal file
3
C2/codes/q60_38.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
echiquier = [ [ 0 for i in range(8) ] for j in range(8) ]
|
||||
echiquier[2][0] = 1
|
||||
echiquier[3][1] = 1
|
||||
1
C2/codes/q61_43.py
Normal file
1
C2/codes/q61_43.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
L = [6, 2, 8, 24, 3, 6, 7, 8]
|
||||
3
C2/codes/q61_44.py
Normal file
3
C2/codes/q61_44.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
p = 8
|
||||
M = [x for x in L if x<p] + [x for x in L if x==p] + [x for
|
||||
x in L if x>p]
|
||||
5
C2/codes/q62_45.py
Normal file
5
C2/codes/q62_45.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def f(L):
|
||||
U = []
|
||||
for i in L:
|
||||
U.append(i**2 - 1)
|
||||
return U
|
||||
1
C2/codes/q64_46.py
Normal file
1
C2/codes/q64_46.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
tableau = [[1,2],[3,4],[5,6]]
|
||||
1
C2/codes/q66_47.py
Normal file
1
C2/codes/q66_47.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
tableau = [ [i+2*j for j in range(4)] for i in range(4)]
|
||||
4
C2/codes/q70_52.py
Normal file
4
C2/codes/q70_52.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
def f(L):
|
||||
return [x*x for x in L if x%2 == 1]
|
||||
|
||||
carre = f([0,1,2,3,4,5,6,7,8,9])
|
||||
1
C2/codes/q71_53.py
Normal file
1
C2/codes/q71_53.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
t = [ x for x in range(2,12) if x % 2 == 1 ]
|
||||
1
C2/codes/q72_54.py
Normal file
1
C2/codes/q72_54.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
L = [['a','b','c'],['bonjour','hello']]
|
||||
3
C2/codes/q73_55.py
Normal file
3
C2/codes/q73_55.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
for i in range(n):
|
||||
for j in range(n):
|
||||
......
|
||||
2
C2/codes/q75_56.py
Normal file
2
C2/codes/q75_56.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
L = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
||||
'K', 'L' ]
|
||||
4
C2/codes/q75_57.py
Normal file
4
C2/codes/q75_57.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# à la fin, on a l'égalité :
|
||||
tab == [['A', 'B', 'C', 'D'],
|
||||
['E', 'F', 'G', 'H'],
|
||||
['I', 'J', 'K', 'L'] ]
|
||||
4
C2/codes/q76_62.py
Normal file
4
C2/codes/q76_62.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
T = [[12,13,14,15],
|
||||
[24,25,26,27],
|
||||
[35,36,49,33],
|
||||
[61,53,55,58]]
|
||||
2
C2/codes/q79_71.py
Normal file
2
C2/codes/q79_71.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
M = [['A','B','C','D'], ['E','F','G','H'],
|
||||
['I','J','K','L']]
|
||||
2
C2/codes/q7_5.py
Normal file
2
C2/codes/q7_5.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def f(x):
|
||||
return (x, x**2)
|
||||
5
C2/codes/q83_72.py
Normal file
5
C2/codes/q83_72.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def f(L):
|
||||
S = []
|
||||
for i in range(len(L)-1):
|
||||
S.append(L[i] + L[i+1])
|
||||
return S
|
||||
8
C2/codes/q84_73.py
Normal file
8
C2/codes/q84_73.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
def quoi(liste):
|
||||
maListe = []
|
||||
for i in range(len(liste))
|
||||
maListe.append(liste[i][0])
|
||||
return maListe
|
||||
|
||||
L = [[5,8,12,1], [20,11,3,8], [3,12,1,4], [2,13,17,3]]
|
||||
m = quoi(L)
|
||||
3
C2/codes/q86_74.py
Normal file
3
C2/codes/q86_74.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Table = [('Grace','Hopper','F',1906),('Tim', 'Berners-Lee',
|
||||
'H', 1955),('Ada', 'Lovelace', 'F', 1815), ('Alan',
|
||||
'Turing', 'H', 1912)]
|
||||
6
C2/codes/q86_75.py
Normal file
6
C2/codes/q86_75.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def fonctionMystere(table):
|
||||
mystere = []
|
||||
for ligne in table:
|
||||
if ligne[2] == 'F':
|
||||
mystere.append(ligne[1])
|
||||
return mystere
|
||||
2
C2/codes/q88_76.py
Normal file
2
C2/codes/q88_76.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
table = [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]
|
||||
table [1][2] = 5
|
||||
2
C2/codes/q89_77.py
Normal file
2
C2/codes/q89_77.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
a = [5, 4, 3, 4, 7]
|
||||
a.append(4)
|
||||
3
C2/codes/q8_6.py
Normal file
3
C2/codes/q8_6.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
tictactoe = [['X', 'O', 'O'],
|
||||
['O', 'O', 'O'],
|
||||
['O', 'O', 'X']]
|
||||
6
C2/codes/q90_78.py
Normal file
6
C2/codes/q90_78.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
image = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0,
|
||||
0, 0]]
|
||||
for i in range(4):
|
||||
for j in range(4):
|
||||
if (i+j) == 3:
|
||||
image[i][j] = 1
|
||||
4
C2/codes/q92_79.py
Normal file
4
C2/codes/q92_79.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
mendeleiev = [['H','.', '.','.','.','.','.','He'],
|
||||
['Li','Be','B','C','N','O','Fl','Ne'],
|
||||
['Na','Mg','Al','Si','P','S','Cl','Ar'],
|
||||
...... ]
|
||||
6
C2/codes/q93_80.py
Normal file
6
C2/codes/q93_80.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
asso = []
|
||||
L = [ ['marc','marie'], ['marie','jean'],
|
||||
['paul','marie'], ['marie','marie'], ['marc','anne'] ]
|
||||
for c in L :
|
||||
if c[1]==’marie’:
|
||||
asso.append(c[0])
|
||||
3
C2/codes/q94_81.py
Normal file
3
C2/codes/q94_81.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
a = [1, 2, 3]
|
||||
b = [4, 5, 6]
|
||||
c = a + b
|
||||
4
C2/codes/q95_82.py
Normal file
4
C2/codes/q95_82.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
mendeleiev = [['H','.', '.','.','.','.','.','He'],
|
||||
['Li','Be','B','C','N','O','Fl','Ne'],
|
||||
['Na','Mg','Al','Si','P','S','Cl','Ar'],
|
||||
...... ]
|
||||
4
C2/codes/q96_83.py
Normal file
4
C2/codes/q96_83.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
data1 = [(‘Bruce’, ’Wayne’), (‘Chuck’, ‘Norris’), (‘Bruce’,
|
||||
‘Lee’), (‘Clark’, ‘Kent’)]
|
||||
data2 = [(‘Diana’, ’Prince’), (‘Chuck’, ‘Norris’),
|
||||
(‘Peter’, ‘Parker’)]
|
||||
9
C2/codes/q97_84.py
Normal file
9
C2/codes/q97_84.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
def f(T):
|
||||
s = 0
|
||||
for k in T:
|
||||
if k == 8:
|
||||
s = s+1
|
||||
if s > 1:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
3
C2/codes/q99_85.py
Normal file
3
C2/codes/q99_85.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
collection = [('Renault', '4L', 1974, 30),
|
||||
('Peugeot', '504', 1970, 82),
|
||||
('Citroën', 'Traction', 1950, 77)]
|
||||
2
C2/codes/q9_7.py
Normal file
2
C2/codes/q9_7.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
M = [['A','B','C','D'], ['E','F','G','H'],
|
||||
['I','J','K','L']]
|
||||
2
C2/codes/r103_a.py
Normal file
2
C2/codes/r103_a.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def test(a,b):
|
||||
return a[0] < b[0]
|
||||
2
C2/codes/r103_b.py
Normal file
2
C2/codes/r103_b.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def test(a,b):
|
||||
return a[0] > b[0]
|
||||
2
C2/codes/r103_c.py
Normal file
2
C2/codes/r103_c.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def test(a,b):
|
||||
return a[1] < b[1]
|
||||
2
C2/codes/r103_d.py
Normal file
2
C2/codes/r103_d.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def test(a,b):
|
||||
return a[1] > b[1]
|
||||
4
C2/codes/r49_a.py
Normal file
4
C2/codes/r49_a.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
L = []
|
||||
for i in range(3):
|
||||
for j in range(4):
|
||||
L.append(tab[i][j])
|
||||
4
C2/codes/r49_b.py
Normal file
4
C2/codes/r49_b.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
L = []
|
||||
for i in range(4):
|
||||
for j in range(3):
|
||||
L.append(tab[i][j])
|
||||
3
C2/codes/r49_c.py
Normal file
3
C2/codes/r49_c.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
L = []
|
||||
for i in range(3):
|
||||
L.append(tab[i])
|
||||
3
C2/codes/r49_d.py
Normal file
3
C2/codes/r49_d.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
L = []
|
||||
for i in range(4):
|
||||
L.append(tab[i])
|
||||
5
C2/codes/r60_a.py
Normal file
5
C2/codes/r60_a.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def ok(echiquier,i,j):
|
||||
for col in range(i):
|
||||
if echiquier[i][col] == 1:
|
||||
return False
|
||||
return True
|
||||
5
C2/codes/r60_b.py
Normal file
5
C2/codes/r60_b.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def ok(echiquier,i,j):
|
||||
for lig in range(i):
|
||||
if echiquier[lig][j] == 1:
|
||||
return False
|
||||
return True
|
||||
5
C2/codes/r60_c.py
Normal file
5
C2/codes/r60_c.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def ok(echiquier,i,j):
|
||||
for col in range(j):
|
||||
if echiquier[i][col] == 1:
|
||||
return False
|
||||
return True
|
||||
5
C2/codes/r60_d.py
Normal file
5
C2/codes/r60_d.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def ok(echiquier,i,j):
|
||||
for lig in range(j):
|
||||
if echiquier[lig][j] == 1:
|
||||
return False
|
||||
return True
|
||||
1
C2/codes/r69_a.py
Normal file
1
C2/codes/r69_a.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
impairs = [1 + nb*2 for nb in range(200)]
|
||||
2
C2/codes/r69_b.py
Normal file
2
C2/codes/r69_b.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
for nb in range(400) :
|
||||
impairs = 1 + 2 * nb
|
||||
1
C2/codes/r69_c.py
Normal file
1
C2/codes/r69_c.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
impairs = [i + 2 for i in range(1,200)]
|
||||
1
C2/codes/r69_d.py
Normal file
1
C2/codes/r69_d.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
impairs = [1, 3, 5, 7, 9] * 40
|
||||
6
C2/codes/r75_a.py
Normal file
6
C2/codes/r75_a.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
tab = []
|
||||
for i in range(4):
|
||||
temp = []
|
||||
for j in range(3):
|
||||
temp.append(L[4*i + j])
|
||||
tab.append(temp)
|
||||
6
C2/codes/r75_b.py
Normal file
6
C2/codes/r75_b.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
tab = []
|
||||
for i in range(4):
|
||||
temp = []
|
||||
for j in range(3):
|
||||
temp.append(L[3*i + j])
|
||||
tab.append(temp)
|
||||
6
C2/codes/r75_c.py
Normal file
6
C2/codes/r75_c.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
tab = []
|
||||
for i in range(3):
|
||||
temp = []
|
||||
for j in range(4):
|
||||
temp.append(L[3*i + j])
|
||||
tab.append(temp)
|
||||
6
C2/codes/r75_d.py
Normal file
6
C2/codes/r75_d.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
tab = []
|
||||
for i in range(3):
|
||||
temp = []
|
||||
for j in range(4):
|
||||
temp.append(L[4*i + j])
|
||||
tab.append(temp)
|
||||
3
C2/codes/r77_a.py
Normal file
3
C2/codes/r77_a.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
T = []
|
||||
for k in range(10):
|
||||
T.append(2*k)
|
||||
3
C2/codes/r77_b.py
Normal file
3
C2/codes/r77_b.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
T = [0] * 10
|
||||
for k in range(9):
|
||||
T[k+1] = 2*(k+1)
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue