parent
a4e349ccc9
commit
7bf2d2ee8b
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
def ascii()
|
@ -0,0 +1,14 @@
|
||||
# Affiche Hello world !
|
||||
|
||||
print("Hello World !")
|
||||
|
||||
# Declaration de variable
|
||||
|
||||
num = 1
|
||||
string = "Oi"
|
||||
liste=[num,string]
|
||||
|
||||
print(liste)
|
||||
|
||||
|
||||
# Utilisation de fonction
|
@ -0,0 +1,2 @@
|
||||
php_flag display_errors on
|
||||
php_value error_reporting E_ALL
|
@ -0,0 +1,3 @@
|
||||
display_errors = On
|
||||
log_errors = Off
|
||||
error_reporting = E_ALL & E_NOTICE & E_DEPRECATED & E_STRICT & E_WARNING
|
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
class VisitorController
|
||||
{
|
||||
private VisitorModel $model;
|
||||
function __construct()
|
||||
{
|
||||
try {
|
||||
global $dsn, $rep, $vues, $error;
|
||||
$this->model = new VisitorModel();
|
||||
$action = $_REQUEST['action'];
|
||||
switch ($action) {
|
||||
case NULL:
|
||||
$this->goToHome();
|
||||
break;
|
||||
case "signUp":
|
||||
$this->signUp();
|
||||
break;
|
||||
case "login":
|
||||
$this->login();
|
||||
break;
|
||||
case "goToHome":
|
||||
$this->goToHome();
|
||||
break;
|
||||
case "goToLogin":
|
||||
$this->goToLogin();
|
||||
break;
|
||||
case "goToSignUp":
|
||||
$this->goToSignUp();
|
||||
break;
|
||||
case "goToQueue":
|
||||
$this->goToLogin();
|
||||
break;
|
||||
default:
|
||||
$error = "Action non valide";
|
||||
require($rep . $vues['erreur']);
|
||||
break;
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
$error = $e->getMessage();
|
||||
require($rep . $vues['erreur']);
|
||||
} catch (Exception $e2) {
|
||||
$error = $e2->getMessage();
|
||||
require($rep . $vues['erreur']);
|
||||
}
|
||||
}
|
||||
public function goToHome()
|
||||
{
|
||||
try {
|
||||
global $rep, $vues;
|
||||
require($rep . $vues['main']);
|
||||
} catch (Exception $e) {
|
||||
$error = "404";
|
||||
require($rep . $vues['erreur']);
|
||||
}
|
||||
}
|
||||
public function goToLogin()
|
||||
{
|
||||
try {
|
||||
global $rep, $vues;
|
||||
require($rep . $vues['login']);
|
||||
} catch (Exception $e) {
|
||||
$error = "404";
|
||||
require($rep . $vues['erreur']);
|
||||
}
|
||||
}
|
||||
public function goToSignUp()
|
||||
{
|
||||
try {
|
||||
global $rep, $vues;
|
||||
require($rep . $vues['signUp']);
|
||||
} catch (Exception $e) {
|
||||
$error = "404";
|
||||
require($rep . $vues['erreur']);
|
||||
}
|
||||
}
|
||||
public function signUp()
|
||||
{
|
||||
try {
|
||||
global $rep, $vues, $error;
|
||||
$this->model->signUp();
|
||||
$this->goToHome();
|
||||
} catch (PDOException $e) {
|
||||
$error = "Erreur de connexion à la base de données.";
|
||||
require($rep . $vues['erreur']);
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
require($rep . $vues['erreur']);
|
||||
}
|
||||
}
|
||||
public function login()
|
||||
{
|
||||
try {
|
||||
global $rep, $vues, $error;
|
||||
$this->model->login();
|
||||
$this->goToHome();
|
||||
} catch (PDOException $e) {
|
||||
$error = "Erreur de connexion à la base de données.";
|
||||
require($rep . $vues['erreur']);
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
require($rep . $vues['erreur']);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
class UtilisateurFactory
|
||||
{
|
||||
public static function createUtilisateur(array $results){
|
||||
if ($results == null){
|
||||
return new Utilisateur("null", "null", "null", false);
|
||||
}
|
||||
foreach($results as $row)
|
||||
{
|
||||
$email = $row['email'];
|
||||
$pseudo=$row['pseudo'];
|
||||
$mdp = $row['mdp'];
|
||||
$estAdmin = $row['estAdmin'];
|
||||
}
|
||||
return new Utilisateur($email, $pseudo, $mdp, $estAdmin);
|
||||
}
|
||||
public static function createTabUtilisateur(array $results){
|
||||
$tabUtilisateur=array();
|
||||
foreach($results as $row)
|
||||
{
|
||||
$tabUtilisateur[]=new Utilisateur($row['email'], $row['pseudo'], $row['mdp'], $row['estAdmin']);
|
||||
}
|
||||
return $tabUtilisateur;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
class UserModel
|
||||
{
|
||||
|
||||
private EnigmeGateway $enigme_gateway;
|
||||
private PartieGateway $partie_gateway;
|
||||
private UtilisateurGateway $utilisateur_gateway;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
try {
|
||||
global $error, $view, $rep;
|
||||
$this->enigme_gateway = new EnigmeGateway();
|
||||
$this->partie_gateway = new PartieGateway();
|
||||
$this->utilisateur_gateway = new UtilisateurGateway();
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
require($rep . $view['erreur']);
|
||||
}
|
||||
}
|
||||
public function addToQueue(){
|
||||
echo '1';
|
||||
if($this->utilisateur_gateway->isAlreadyInqueue($_SESSION['utilisateur']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
echo '2';
|
||||
if (!$this->partie_gateway->partieInQueueExists()) {
|
||||
echo '3';
|
||||
$tabEnigme = $this->enigme_gateway->findMultiEnigma();
|
||||
$idNewPartie = $this->partie_gateway->findPartieMaxId();
|
||||
$partie=$this->partie_gateway->creerPartieMulti($idNewPartie,$tabEnigme);
|
||||
}
|
||||
else{
|
||||
echo '4';
|
||||
$idPartieInQueue = $this->partie_gateway->findPartieInQueue();
|
||||
echo '5';
|
||||
$tabEnigme = $this->enigme_gateway->findEnigmaFromPartie($idPartieInQueue);
|
||||
echo '6';
|
||||
$partie = $this->partie_gateway->rejoindrePartieMulti($idPartieInQueue, $tabEnigme);
|
||||
echo '7';
|
||||
}
|
||||
echo '8';
|
||||
$this->utilisateur_gateway->addToQueue($_SESSION['utilisateur'],$partie);
|
||||
$userGroup=$this->utilisateur_gateway->findUsersInQueue();
|
||||
//trigger_event('add_to_queue',$userGroup);
|
||||
}
|
||||
|
||||
public function AddUserToQueueEvent(){
|
||||
$userGroup=$this->utilisateur_gateway->findUsersInQueue();
|
||||
if($userGroup.count()>=4)
|
||||
{
|
||||
$this->utilisateur_gateway->launchGame();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
class VisitorModel
|
||||
{
|
||||
|
||||
private EnigmeGateway $enigme_gateway;
|
||||
private PartieGateway $partie_gateway;
|
||||
private UtilisateurGateway $utilisateur_gateway;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
try {
|
||||
global $error, $view, $rep;
|
||||
$this->enigme_gateway = new EnigmeGateway();
|
||||
$this->partie_gateway = new PartieGateway();
|
||||
$this->utilisateur_gateway = new UtilisateurGateway();
|
||||
} catch (Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
require($rep . $view['erreur']);
|
||||
}
|
||||
}
|
||||
|
||||
public function signUp()
|
||||
{
|
||||
global $sel, $error;
|
||||
$validation = new Validation();
|
||||
if (!$validation->ValidateEmail($_REQUEST['email'])) {
|
||||
$error = "Email invalides.";
|
||||
throw (new Exception("Email non valide"));
|
||||
}
|
||||
if (!$validation->ValidateUsername($_REQUEST['username'])) {
|
||||
$error = "Nom d'utilisateur invalides. Il ne doit pas contenir de caractère spéciaux.";
|
||||
throw (new Exception("Pseudo non valide"));
|
||||
}
|
||||
if (!$validation->ValidatePassword($_REQUEST['password'])) {
|
||||
$error = "Mots de passe invalides. Il ne doit pas dépasser 100 caractères.";
|
||||
throw (new Exception("Mot de passe non valide"));
|
||||
}
|
||||
$j = $this->utilisateur_gateway->getUtilisateurByEmail($_REQUEST['email']);
|
||||
if ($j->getEmail() != "null") {
|
||||
$error = "Email déjà utilisé.";
|
||||
throw (new Exception("Email déjà utilisé"));
|
||||
}
|
||||
$password = password_hash($_REQUEST['password'] . $sel, PASSWORD_DEFAULT);
|
||||
$utilisateur = new Utilisateur($_REQUEST['email'], $_REQUEST['username'], $password, false);
|
||||
$this->utilisateur_gateway->insert($utilisateur);
|
||||
$_SESSION['role'] = 'user';
|
||||
$_SESSION['utilisateur'] = $utilisateur;
|
||||
}
|
||||
public function login()
|
||||
{
|
||||
global $vue, $sel, $error;
|
||||
$utilisateur = $this->utilisateur_gateway->getUtilisateurByEmail($_REQUEST['email']);
|
||||
if ($utilisateur->getEmail() == "null") {
|
||||
$error = "Utilisateur non trouvé.";
|
||||
throw new Exception("Utilisateur introuvable");
|
||||
}
|
||||
$mdp = $this->utilisateur_gateway->getMdpByEmail($_REQUEST['email']);
|
||||
if (! password_verify($_REQUEST['password'] . $sel, $mdp)) {
|
||||
$error = "Mot de passe incorrect.";
|
||||
throw new Exception("Mot de passe invalide");
|
||||
}
|
||||
$estAdmin = $this->utilisateur_gateway->getEstAdminByEmail($_REQUEST['email']);
|
||||
if ($estAdmin == true) {
|
||||
$_SESSION['role'] = "admin";
|
||||
} else {
|
||||
$_SESSION['role'] = "user";
|
||||
}
|
||||
$_SESSION['utilisateur'] = $utilisateur;
|
||||
$_SESSION['connected'] = 'true';
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 4.3 MiB |
After Width: | Height: | Size: 296 KiB |
Before Width: | Height: | Size: 48 KiB |
@ -1,226 +0,0 @@
|
||||
/*Fonts CSS */
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Orbitron&display=swap');
|
||||
|
||||
/*Default CSS*/
|
||||
|
||||
|
||||
/*Ace CSS */
|
||||
|
||||
.ace{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
/* Main Button Css */
|
||||
|
||||
.buttons{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.compiler_class .buttons div{
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.buttons .btn{
|
||||
position: relative;
|
||||
width: 120px;
|
||||
height: 60px;
|
||||
display: inline-block;
|
||||
background: transparent;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
|
||||
.buttons .btn:before, .buttons .btn:after
|
||||
{
|
||||
content:'';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
transition: 0.5s;
|
||||
background: #f00
|
||||
}
|
||||
|
||||
|
||||
.buttons .btn:nth-child(1):before, .buttons .btn:nth-child(1):after
|
||||
{
|
||||
background: linear-gradient(45deg, #00ccff, #0e1538, #d400d4)
|
||||
}
|
||||
|
||||
.buttons .btn:nth-child(2):before, .buttons .btn:nth-child(2):after
|
||||
{
|
||||
background: linear-gradient(45deg, #d400d4, #0e1538, #fb5942);
|
||||
}
|
||||
|
||||
.buttons .btn:hover:before
|
||||
{
|
||||
inset: -3px;
|
||||
}
|
||||
|
||||
.buttons .btn:hover:after
|
||||
{
|
||||
inset: -3px;
|
||||
filter: blur(10px);
|
||||
}
|
||||
|
||||
.buttons .btn span{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
background: #0e1538;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 1.2em;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
color: #fff;
|
||||
border: 1px solid #040a29;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.buttons .btn span::before{
|
||||
content:'';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -50%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(255,255,255,0.075);
|
||||
transform: skew(25deg)
|
||||
}
|
||||
|
||||
|
||||
|
||||
.buttons .btn .noAnimation {
|
||||
animation: none;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
|
||||
/* Modal CSS */
|
||||
|
||||
.modal-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
|
||||
display: none;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: var(--m-background);
|
||||
}
|
||||
|
||||
.modal-container:target {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.modal {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
width: 30%;
|
||||
height: 35%;
|
||||
padding: 10px 0;
|
||||
border-radius: .8rem;
|
||||
|
||||
color: aliceblue;
|
||||
background: var(--background);
|
||||
box-shadow: var(--m-shadow, .4rem .4rem 8.2rem .2rem) var(--shadow-1);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Modal H1 */
|
||||
|
||||
.modal #containerResult{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
/* Modal Container Buttons */
|
||||
|
||||
.modal .buttons{
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
height: 100%;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.modal .buttons #top{
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: flex-start;
|
||||
width: auto;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
.modal .buttons #bottom{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
width: auto;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
/* Modal buttons btn */
|
||||
|
||||
.modal .buttons .btn{
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin : 0 15px;
|
||||
}
|
||||
|
||||
.modal .buttons #bottom{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.modal .buttons #fleche{
|
||||
display: none;
|
||||
width: 75px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.modal .buttons .btn span{
|
||||
background: #06124b;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.modal .buttons #bottom .btn:nth-child(1):before, .modal .buttons #bottom .btn:nth-child(1):after
|
||||
{
|
||||
background: linear-gradient(45deg, #d400d4, #0e1538, #fb5942);
|
||||
}
|
||||
|
||||
/* Console CSS*/
|
||||
|
||||
#console{
|
||||
font-size: .8rem;
|
||||
opacity: 0.85;
|
||||
letter-spacing: 1px;
|
||||
background-color: #040a29;
|
||||
color: #fff;
|
||||
border: solid 1px #414141;
|
||||
max-width: 95%;
|
||||
max-height: 85%;
|
||||
line-height: 1.5;
|
||||
resize: none;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
//~ Function that test the user code
|
||||
|
||||
async function submit(){
|
||||
var test = editor.getValue()+`\n
|
||||
import random as r
|
||||
|
||||
def multiVerif(a,b):
|
||||
return a*b
|
||||
|
||||
def multiTest(x):
|
||||
multiplication(1,1)
|
||||
for i in range(x):
|
||||
a=r.randint(0,100)
|
||||
b=r.randint(0,100)
|
||||
if(multiplication(a,b) != multiVerif(a,b)):
|
||||
return False
|
||||
return True
|
||||
|
||||
print(multiTest(5))
|
||||
|
||||
`;
|
||||
exec("print('True')", "code");
|
||||
exec(test, "solution");
|
||||
result.innerHTML = "Test en cours...";
|
||||
await new Promise(r => setTimeout(r, 1500));
|
||||
check();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,41 @@
|
||||
//~ Function that test the user code
|
||||
|
||||
async function submit(){
|
||||
var test = editor.getValue()+`\n
|
||||
import random as r
|
||||
|
||||
def conditionVerif(list,a):
|
||||
for i in list:
|
||||
if(i == 1):
|
||||
a += 1
|
||||
elif(i != 2):
|
||||
a -=1
|
||||
elif(i < 3):
|
||||
a *= a
|
||||
elif(i > 6):
|
||||
a +=4
|
||||
else:
|
||||
a +=5
|
||||
return a
|
||||
|
||||
def conditionTest(x):
|
||||
condition([],0)
|
||||
list=[]
|
||||
for i in range(x):
|
||||
for i in range(r.randint(1,10)):
|
||||
list.append(r.randint(1,10))
|
||||
a=r.randint(1,10)
|
||||
if(condition(list,a)!=conditionVerif(list,a)):
|
||||
return False
|
||||
return True
|
||||
|
||||
print(conditionTest(5))
|
||||
`;
|
||||
exec("print('True')", "code");
|
||||
exec(test, "solution");
|
||||
result.innerHTML = "Test en cours...";
|
||||
await new Promise(r => setTimeout(r, 1500));
|
||||
check();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
//~ Function that test the user code
|
||||
|
||||
async function submit(){
|
||||
var test = editor.getValue()+`\n
|
||||
import random as r
|
||||
|
||||
def triVerif(a,b):
|
||||
s = ""
|
||||
i = 0
|
||||
while len(s)<len(a+b):
|
||||
if(len(a)>i):
|
||||
s += a[i]
|
||||
if(len(b)>i):
|
||||
s += b[i]
|
||||
i += 1
|
||||
return s
|
||||
|
||||
def triTest(x):
|
||||
a = "Hlowrd"
|
||||
b = "el ol"
|
||||
if(triVerif(a,b)!=tri(a,b)):
|
||||
return False
|
||||
return True
|
||||
|
||||
print(triTest(5))
|
||||
`;
|
||||
exec("print('True')", "code");
|
||||
exec(test, "solution");
|
||||
result.innerHTML = "Test en cours...";
|
||||
await new Promise(r => setTimeout(r, 1500));
|
||||
check();
|
||||
}
|
||||
|
||||
|
@ -1,93 +1,195 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Cul de Chouette</title>
|
||||
<link rel="stylesheet" href="../../CSS/Enigme.css"/>
|
||||
<link rel="stylesheet" href="../../CSS/Home.css">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||
<style>
|
||||
html{
|
||||
background-image: url(../../../assets/img/Background2.jpg);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="enigme">
|
||||
<div class="titre_pre">
|
||||
<div class="retour">
|
||||
<a class="material-icons" id="home" href="../Home.html" style="font-size:36px;color:white;">home</a>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Chouette</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
|
||||
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
||||
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
|
||||
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
/>
|
||||
<link rel="stylesheet" href="View/src/CSS/Enigme.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid px-5">
|
||||
<!-- First Row -->
|
||||
<div class="row py-4">
|
||||
<div class="col-9 d-flex align-items-center px-0">
|
||||
<a
|
||||
class="material-icons pl-0"
|
||||
id="home"
|
||||
href="index.php?action=goToHome"
|
||||
style="font-size: 40px; color: white"
|
||||
>home</a
|
||||
>
|
||||
</div>
|
||||
<button
|
||||
style="background-color: transparent; border: none"
|
||||
onclick="displayHelp()"
|
||||
class="col-3 d-flex align-items-center"
|
||||
>
|
||||
<div class="col-10 text-right px-3">
|
||||
<p style="font-size: 14px; color: white"><b>Besoin d'aide ?</b></p>
|
||||
</div>
|
||||
<div class="col-2 text-right">
|
||||
<img
|
||||
src="View/assets/img/Foxy.png"
|
||||
alt="Logo"
|
||||
class="rounded-circle moving-fox"
|
||||
style="border: 1px solid #44fff6; width: 60px; height: 60px"
|
||||
/>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
<div class="sign">
|
||||
<h1>
|
||||
<span class="fast-flicker">c</span>
|
||||
<span>hou</span>
|
||||
<span class="flicker">e</span>
|
||||
<span>tte</span>
|
||||
</h1>
|
||||
</div><br>
|
||||
</div>
|
||||
<h2>Consigne</h2><br>
|
||||
<p class="enonce">
|
||||
Écrire une fonction chouette qui, pour une valeur donnée, renvoie une liste contenant toutes les solutions de somme de 3 dés pouvant donner cette valeur.
|
||||
</br>La valeur peut aller de 3 à 18 .
|
||||
<!-- End First Row -->
|
||||
|
||||
<!-- Second Row -->
|
||||
<div class="row">
|
||||
<!-- First Column -->
|
||||
<div
|
||||
class="col-3 rounded p-3"
|
||||
style="background-color: #222831; min-height: 80vh; height: auto"
|
||||
>
|
||||
<h2 class="text-left py-3" style="color: #44fff6; font-weight: 500">
|
||||
Chouette
|
||||
</h2>
|
||||
<p>
|
||||
Écrire une fonction <b style="color: violet;">chouette</b> qui, pour une <b style="color: #44fff6;">valeur</b> donnée,
|
||||
renvoie une <b style="color:yellow">liste</b>
|
||||
contenant toutes les solutions de somme de 3 dés pouvant donner cette <b style="color: #44fff6;">valeur</b>.
|
||||
</br>La <b style="color:#44fff6;">valeur</b> peut aller de 3 à 18 .
|
||||
</br>Les solutions doivent être uniques.(1,2,3) et (3,2,1) sont la même solution.
|
||||
</p><br><br>
|
||||
<h2>Exemple</h2><br>
|
||||
<p>Entrée : 7</p>
|
||||
<p>Sortie : [[1,1,5],[1,2,4],[1,3,3],[2,2,3]]</p><br>
|
||||
<h2>Aide</h2><br>
|
||||
<p>On cherche à savoir si la somme de 3 dés (trois variables allant de 1 à 6) est égale à une valeur donné.</p>
|
||||
<p>Pour cela on peut utiliser la structure suivante on d1 ( le premier dé) va varier de 1 à 6.</p>.
|
||||
<p>for d1 in range(1, 7):<br>  for d2 in range (1, 7):<br>    #Faire...</p>
|
||||
</div>
|
||||
<div class='ace' id='editor'>def chouette(valeur):
|
||||
res=list()
|
||||
for i in range(1, 7):
|
||||
for j in range(i, 7):
|
||||
for k in range(j, 7):
|
||||
if (i+j+k) == valeur:
|
||||
res.append([i, j, k])
|
||||
return res
|
||||
</div>
|
||||
<div class='compiler_class'>
|
||||
<textarea id='console' readonly rows="30" cols="100"></textarea>
|
||||
<div class="buttons">
|
||||
<div>
|
||||
<a onclick="run_init()" class="btn">
|
||||
<span class="noAnimation">Run</span>
|
||||
</a>
|
||||
<a href="#m1-o" onclick="submit()" class="btn">
|
||||
<span class="noAnimation">Submit</span>
|
||||
</a>
|
||||
</div>
|
||||
</p>
|
||||
<h3 class="text-left pb-3 pt-5" style="color: #44fff6">Exemple</h3>
|
||||
<p><b>Entrée</b> : 7</p>
|
||||
<p><b>Sortie</b> : [[1,1,5],[1,2,4],[1,3,3],[2,2,3]]</p>
|
||||
<h3
|
||||
class="text-left pb-3 pt-5 help"
|
||||
style="color: #44fff6; display: none"
|
||||
>
|
||||
Aide
|
||||
</h3>
|
||||
<div style="display: none" class="help row">
|
||||
<p>
|
||||
On cherche à savoir si la somme de 3 dés (trois variables allant de 1 à 6) est égale à une valeur donné.
|
||||
<br />Pour cela on peut utiliser la structure suivante on d1 ( le premier dé) va varier de 1 à 6.
|
||||
</p>
|
||||
<code style="font-size: 18px">
|
||||
for d1 in range(1, 7):<br>
|
||||
  for d2 in range (1, 7):<br>
|
||||
    #Faire...
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End First Column -->
|
||||
|
||||
<!-- Second Column -->
|
||||
<div class="col-5 pr-0">
|
||||
<div class="ace rounded" id="editor">def chouette(valeur):
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Second Column -->
|
||||
|
||||
<div class="modal-container" id="m1-o" style="--m-background: transparent;">
|
||||
<div class="modal">
|
||||
<div id="containerResult">
|
||||
<h1 id="result"></h1>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<div id="top">
|
||||
<a href="#" class="btn">
|
||||
<span class="noAnimation">x</span>
|
||||
</a>
|
||||
<!-- Third Column -->
|
||||
<div class="col-4">
|
||||
<textarea
|
||||
id="console"
|
||||
readonly
|
||||
style="width: 100%; min-height: 65vh; height: auto"
|
||||
class="p-3 rounded"
|
||||
></textarea>
|
||||
|
||||
<div class="row pt-5 text-center" style="cursor: pointer">
|
||||
<div class="col-6">
|
||||
<a onclick="run_init()" class="btn">
|
||||
<span>Run</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button
|
||||
onclick="submit()"
|
||||
class="btn"
|
||||
data-toggle="modal"
|
||||
data-target="#modal"
|
||||
>
|
||||
<span>Submit</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bottom">
|
||||
<a href="CesarEncrypt.html" class="btn" id="fleche">
|
||||
<span class="noAnimation">Next</span>
|
||||
</a>
|
||||
<!-- End Third Column -->
|
||||
</div>
|
||||
<!-- End Second Row -->
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div
|
||||
class="modal fade"
|
||||
id="modal"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
aria-labelledby="exampleModalCenterTitle"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2
|
||||
class="modal-title"
|
||||
id="exampleModalLongTitle"
|
||||
style="color: black"
|
||||
>
|
||||
Results
|
||||
</h2>
|
||||
<button
|
||||
type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Close"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h5 id="result" style="color: black"></h5>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="index.php?action=goToCesarEncrypt" class="btn" style="display: none" id="next">
|
||||
<span>NEXT</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../../JS/base.js"></script>
|
||||
<script src="../../JS/chouette.js"></script>
|
||||
</body>
|
||||
<!-- End Modal -->
|
||||
|
||||
<script
|
||||
src="https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script
|
||||
src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script src="View/src/JS/base.js"></script>
|
||||
<script src="View/src/JS/chouette.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -0,0 +1,221 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>First Test</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
|
||||
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
||||
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
|
||||
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<link rel="stylesheet" href="View/src/CSS/FirstTest.css" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark pb-5">
|
||||
<div class="container-fluid mx-0">
|
||||
<div class="nav-item nav-link">
|
||||
<a class="navbar-brand" href="index.php?action=goToHome">Home</a>
|
||||
</div>
|
||||
<div class="mx-auto d-flex">
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #fff; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
Test de qualification
|
||||
</h5>
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #44fff6; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
10/10
|
||||
</h5>
|
||||
</div>
|
||||
<div class="nav-link">
|
||||
<a class="navbar-brand" href="#" style="color: gray;">Next</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<!-- First Test -->
|
||||
<div
|
||||
class="row rounded p-3 m-3"
|
||||
style="
|
||||
background: #16222a; /* fallback for old browsers */
|
||||
background: -webkit-linear-gradient(
|
||||
to right,
|
||||
#3a6073,
|
||||
#16222a
|
||||
); /* Chrome 10-25, Safari 5.1-6 */
|
||||
background: linear-gradient(to right, #3a6073, #16222a);
|
||||
"
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<section
|
||||
style="background-color: #222831; min-height: 0"
|
||||
class="p-3 rounded m-0">
|
||||
<p>
|
||||
Il exsite un autre type de boucle en pyhton qui est la boucle <b style="color: violet">while</b>.
|
||||
Elle permet de répéter une action tant qu'une condition est vraie.
|
||||
</p>
|
||||
<p>
|
||||
Voici un petit exemple :
|
||||
</p>
|
||||
<code style="font-size: 18px">
|
||||
list = []<br/>
|
||||
while (len(list) < 5):<br/>
|
||||
list.append(1)<br/>
|
||||
</code>
|
||||
<br/>
|
||||
<p>
|
||||
Tant que la liste ne contient pas 5 éléments, on ajoute un élément.
|
||||
</p>
|
||||
<p>
|
||||
Bien je te propose de passer ton dernier test de qualification.
|
||||
Tu dois coder la fonction <b style="color: violet;">tri</b>.
|
||||
Cette fonction prend en paramètre deux <b style="color: yellow;">chaine de caractère</b>,
|
||||
remet les lettres dans l'orde et
|
||||
retourne la <b style="color: yellow;">chaine de caractère</b>.
|
||||
Voici un exemple pour que tu comprennes mieux :
|
||||
</p>
|
||||
<code style="font-size: 18px">
|
||||
def tri(a,b) :<br/>
|
||||
# ton code ici<br/><br/>
|
||||
a = "Hlowrd"<br/>
|
||||
b = "el ol"<br/>
|
||||
print(trie(a,b)) -> retourne "Hello World"
|
||||
</code>
|
||||
<br></br>
|
||||
<p>
|
||||
La fonction <b style="color: violet;">tri</b> prend tour a tour les lettres de a et b.
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-2 align-self-center">
|
||||
<img
|
||||
src="View/assets/img/Foxy.png"
|
||||
alt="Logo"
|
||||
class="img-fluid rounded-circle"
|
||||
style="
|
||||
border: 2px solid #44fff6;
|
||||
background-image: url('View/src/assets/img/BackgroundMain.jpg');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-5">
|
||||
<!-- Editor -->
|
||||
<div class="col-8">
|
||||
<div class="ace rounded ace-1" id="editor" style="min-height: 40vh">def tri(a,b):
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Editor -->
|
||||
|
||||
<!-- Console -->
|
||||
<div class="col-4" style="min-height: 40vh">
|
||||
<textarea
|
||||
id="console"
|
||||
readonly
|
||||
style="width: 100%; height: 60%"
|
||||
class="p-3 rounded"
|
||||
></textarea>
|
||||
<!-- End Return Code -->
|
||||
|
||||
<!-- Buttons -->
|
||||
<div
|
||||
class="row pt-5 text-center"
|
||||
style="cursor: pointer; height: 20%"
|
||||
>
|
||||
<div class="col-6">
|
||||
<a onclick="run_init()" class="btn">
|
||||
<span>Run</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button
|
||||
onclick="submit()"
|
||||
class="btn"
|
||||
data-toggle="modal"
|
||||
data-target="#modal"
|
||||
>
|
||||
<span>Submit</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Buttons -->
|
||||
</div>
|
||||
<!-- End Console -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- End First Test -->
|
||||
|
||||
</div>
|
||||
<!-- Modal -->
|
||||
<div
|
||||
class="modal fade"
|
||||
id="modal"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
aria-labelledby="exampleModalCenterTitle"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2
|
||||
class="modal-title"
|
||||
id="exampleModalLongTitle"
|
||||
style="color: black"
|
||||
>
|
||||
Results
|
||||
</h2>
|
||||
<button
|
||||
type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Close"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h5 id="result" style="color: black"></h5>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="index.php?action=goToNext&num=9" class="btn" style="display: none" id="next">
|
||||
<span>NEXT</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Modal -->
|
||||
<script
|
||||
src="https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script
|
||||
src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script src="View/src/JS/base.js"></script>
|
||||
<script src="View/src/JS/String.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,210 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>First Test</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
|
||||
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
||||
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
|
||||
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<link rel="stylesheet" href="View/src/CSS/FirstTest.css" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark pb-5">
|
||||
<div class="container-fluid mx-0">
|
||||
<div class="nav-item nav-link">
|
||||
<a class="navbar-brand" href="index.php?action=goToHome">Home</a>
|
||||
</div>
|
||||
<div class="mx-auto d-flex">
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #fff; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
Test de qualification
|
||||
</h5>
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #44fff6; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
3/10
|
||||
</h5>
|
||||
</div>
|
||||
<div class="nav-link">
|
||||
<a class="navbar-brand" href="index.php?action=goToNext&num=4">Next</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<!-- First Test -->
|
||||
<div
|
||||
class="row rounded p-3 m-3"
|
||||
style="
|
||||
background: #16222a; /* fallback for old browsers */
|
||||
background: -webkit-linear-gradient(
|
||||
to right,
|
||||
#3a6073,
|
||||
#16222a
|
||||
); /* Chrome 10-25, Safari 5.1-6 */
|
||||
background: linear-gradient(to right, #3a6073, #16222a);
|
||||
"
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<section
|
||||
style="background-color: #222831; min-height: 0"
|
||||
class="p-3 rounded m-0"
|
||||
>
|
||||
<p>
|
||||
Passons désormais à la suite de notre test de qualification. Je vais te présenter les <b style="color:violet">listes</b>.
|
||||
</p>
|
||||
<p>
|
||||
Une liste est une structure de données qui permet de stocker plusieurs valeur. En python, on peut créer une liste en utilisant les crochets <b style="color:violet">[ ]</b>.
|
||||
</p>
|
||||
<p>
|
||||
Voici un exemple :
|
||||
</p>
|
||||
<code style="font-size: 18px">
|
||||
ma_liste = [1, 2,"Hello","World", 3.14]
|
||||
</code>
|
||||
<br></br>
|
||||
<p>
|
||||
Ici on crée une liste composé de plusieurs éléments. On peut accéder à un élément de la liste en utilisant son <b style="color:violet">indice</b>. L'indice d'un élément correspond à sa position dans la liste. On commence à compter à partir de 0.
|
||||
</p>
|
||||
<code style="font-size: 18px">
|
||||
ma_liste[0] = 3
|
||||
</code>
|
||||
<br></br>
|
||||
<p>
|
||||
Dans l'exemple précédent dans la liste <b style="color:violet">ma_liste</b>, on accède à l'élément d'indice 0 et on lui donne la valeur 3.
|
||||
</p>
|
||||
<p>
|
||||
Désormias c'est a toi d'expérimenter ! Je t'ai préparé un petit programme qui vas t'en apprendre plus sur les listes.
|
||||
Si tu veux plus d'information néssite pas a aller voir sur se site : <a href="https://docs.python.org/fr/3/tutorial/datastructures.html" target="_blank" style="color: #44fff6">https://docs.python.org/fr/3/tutorial/datastructures.html</a>
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-2 align-self-center">
|
||||
<img
|
||||
src="View/assets/img/Foxy.png"
|
||||
alt="Logo"
|
||||
class="img-fluid rounded-circle"
|
||||
style="
|
||||
border: 2px solid #44fff6;
|
||||
background-image: url('View/assets/img/BackgroundMain.jpg');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-5">
|
||||
<!-- Editor -->
|
||||
<div class="col-8">
|
||||
<div class="ace rounded ace-1" id="editor" style="min-height: 40vh"># Initialise une liste
|
||||
ma_liste = [1, 2,"Hello","World", 3.14]
|
||||
print("Notre liste de départ :")
|
||||
print(ma_liste)
|
||||
print("")
|
||||
|
||||
# Remplace le premier élément par 3
|
||||
print("Remplacement du premier élément par 3")
|
||||
ma_liste[0] = 3
|
||||
print(ma_liste)
|
||||
print("")
|
||||
|
||||
# Remplace le dernier élément par "toto"
|
||||
print("Remplacement du dernier élément par 'toto'")
|
||||
ma_liste[-1] = "toto"
|
||||
print(ma_liste)
|
||||
print("")
|
||||
|
||||
# Ajoute 5.4 a la fin de la liste
|
||||
print("Ajout de 5.4 a la fin de la liste")
|
||||
ma_liste.append(5.4)
|
||||
print(ma_liste)
|
||||
print("")
|
||||
|
||||
# Insert 2 à l'index 3
|
||||
print("Insertion de 2 à l'index 3")
|
||||
ma_liste.insert(3,2)
|
||||
print(ma_liste)
|
||||
print("")
|
||||
|
||||
# Supprimer le premier 2 de la liste
|
||||
print("Suppretion du premier 2 de la liste")
|
||||
ma_liste.remove(2)
|
||||
print(ma_liste)
|
||||
print("")
|
||||
|
||||
# Enlève de la liste l'élément situé à la position 1 et le renvoie
|
||||
print("Suppression de l'élément situé à la position 1")
|
||||
p = ma_liste.pop(1)
|
||||
print(ma_liste)
|
||||
print("L'élément retiré :", p)
|
||||
print("")
|
||||
|
||||
# Renvoie la longueur de la liste
|
||||
print("Longueur de la liste :", len(ma_liste))
|
||||
print("")
|
||||
|
||||
# Ps l'instruction 'len' ne fonctionne pas que pour les listes
|
||||
print("Longueur de la chaine de caractère 'toto' :", len("toto"))</div>
|
||||
</div>
|
||||
<!-- End Editor -->
|
||||
|
||||
<!-- Console -->
|
||||
<div class="col-4" style="min-height: 40vh">
|
||||
<textarea
|
||||
id="console"
|
||||
readonly
|
||||
style="width: 100%; height: 60%"
|
||||
class="p-3 rounded"
|
||||
></textarea>
|
||||
<!-- End Return Code -->
|
||||
|
||||
<!-- Buttons -->
|
||||
<div
|
||||
class="row pt-5 text-center"
|
||||
style="cursor: pointer; height: 20%"
|
||||
>
|
||||
<div class="col">
|
||||
<a onclick="run_init()" class="btn">
|
||||
<span>Run</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Buttons -->
|
||||
</div>
|
||||
<!-- End Console -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- End First Test -->
|
||||
</div>
|
||||
|
||||
<script
|
||||
src="https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script
|
||||
src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script src="View/src/JS/base.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,149 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>First Test</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
|
||||
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
||||
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
|
||||
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<link rel="stylesheet" href="View/src/CSS/FirstTest.css" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark pb-5">
|
||||
<div class="container-fluid mx-0">
|
||||
<div class="nav-item nav-link">
|
||||
<a class="navbar-brand" href="index.php?action=goToHome">Home</a>
|
||||
</div>
|
||||
<div class="mx-auto d-flex">
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #fff; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
Test de qualification
|
||||
</h5>
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #44fff6; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
5/10
|
||||
</h5>
|
||||
</div>
|
||||
<div class="nav-link">
|
||||
<a class="navbar-brand" href="index.php?action=goToNext&num=6">Next</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<!-- First Test -->
|
||||
<div
|
||||
class="row rounded p-3 m-3"
|
||||
style="
|
||||
background: #16222a; /* fallback for old browsers */
|
||||
background: -webkit-linear-gradient(
|
||||
to right,
|
||||
#3a6073,
|
||||
#16222a
|
||||
); /* Chrome 10-25, Safari 5.1-6 */
|
||||
background: linear-gradient(to right, #3a6073, #16222a);
|
||||
"
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<section
|
||||
style="background-color: #222831; min-height: 0"
|
||||
class="p-3 rounded m-0">
|
||||
<p>
|
||||
Je vais désormais te présenter l'instruction <b style="color: violet;">return</b>.
|
||||
Un return est une instruction qui permet de renvoyer une valeur.
|
||||
</p>
|
||||
<p>
|
||||
Par exemple, la fonction suivante renvoie la somme de deux nombres :
|
||||
</p>
|
||||
<code style="font-size: 18px">
|
||||
def addition(a, b):<br />
|
||||
return a + b
|
||||
</code>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-2 align-self-center">
|
||||
<img
|
||||
src="View/assets/img/Foxy.png"
|
||||
alt="Logo"
|
||||
class="img-fluid rounded-circle"
|
||||
style="
|
||||
border: 2px solid #44fff6;
|
||||
background-image: url('View/assets/img/BackgroundMain.jpg');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-5">
|
||||
<!-- Editor -->
|
||||
<div class="col-8">
|
||||
<div class="ace rounded ace-1" id="editor" style="min-height: 40vh">def addition(a,b) :
|
||||
return a+b
|
||||
|
||||
somme=addition(6,4)
|
||||
print(somme)</div>
|
||||
</div>
|
||||
<!-- End Editor -->
|
||||
|
||||
<!-- Console -->
|
||||
<div class="col-4" style="min-height: 40vh">
|
||||
<textarea
|
||||
id="console"
|
||||
readonly
|
||||
style="width: 100%; height: 60%"
|
||||
class="p-3 rounded"
|
||||
></textarea>
|
||||
<!-- End Return Code -->
|
||||
|
||||
<!-- Buttons -->
|
||||
<div
|
||||
class="row pt-5 text-center"
|
||||
style="cursor: pointer; height: 20%"
|
||||
>
|
||||
<div class="col">
|
||||
<a onclick="run_init()" class="btn">
|
||||
<span>Run</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Buttons -->
|
||||
</div>
|
||||
<!-- End Console -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- End First Test -->
|
||||
</div>
|
||||
|
||||
<script
|
||||
src="https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script
|
||||
src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script src="View/src/JS/base.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,198 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>First Test</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
|
||||
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
||||
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
|
||||
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<link rel="stylesheet" href="View/src/CSS/FirstTest.css" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark pb-5">
|
||||
<div class="container-fluid mx-0">
|
||||
<div class="nav-item nav-link">
|
||||
<a class="navbar-brand" href="index.php?action=goToHome">Home</a>
|
||||
</div>
|
||||
<div class="mx-auto d-flex">
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #fff; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
Test de qualification
|
||||
</h5>
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #44fff6; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
6/10
|
||||
</h5>
|
||||
</div>
|
||||
<div class="nav-link">
|
||||
<a class="navbar-brand" href="#" style="color: gray;">Next</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<!-- First Test -->
|
||||
<div
|
||||
class="row rounded p-3 m-3"
|
||||
style="
|
||||
background: #16222a; /* fallback for old browsers */
|
||||
background: -webkit-linear-gradient(
|
||||
to right,
|
||||
#3a6073,
|
||||
#16222a
|
||||
); /* Chrome 10-25, Safari 5.1-6 */
|
||||
background: linear-gradient(to right, #3a6073, #16222a);
|
||||
"
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<section
|
||||
style="background-color: #222831; min-height: 0"
|
||||
class="p-3 rounded m-0">
|
||||
<p>
|
||||
J'èspère que tu es prêt pour ton premier test !
|
||||
Écrit une function <b style="color: violet;">multiplicaton</b>.
|
||||
qui returne la multiplication de deux nombres.
|
||||
</p>
|
||||
<p>
|
||||
Comme d'habitue, tu peux tester ton code en cliquant sur le bouton <b style="color: red;">Run</b>.
|
||||
Si tu es sur que ton code est bon, clique sur le bouton <b style="color: green;">Submit</b>
|
||||
pour valider ton test. J'ai pris son de désactiver le bouton <b style="color:#44fff6;">Next</b>
|
||||
afin que tu ne puisses pas passer à la prochaine étape avant d'avoir terminé ce test.
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-2 align-self-center">
|
||||
<img
|
||||
src="View/assets/img/Foxy.png"
|
||||
alt="Logo"
|
||||
class="img-fluid rounded-circle"
|
||||
style="
|
||||
border: 2px solid #44fff6;
|
||||
background-image: url('View/assets/img/BackgroundMain.jpg');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-5">
|
||||
<!-- Editor -->
|
||||
<div class="col-8">
|
||||
<div class="ace rounded ace-1" id="editor" style="min-height: 40vh">def multiplication(a,b) :
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Editor -->
|
||||
|
||||
<!-- Console -->
|
||||
<div class="col-4" style="min-height: 40vh">
|
||||
<textarea
|
||||
id="console"
|
||||
readonly
|
||||
style="width: 100%; height: 60%"
|
||||
class="p-3 rounded"
|
||||
></textarea>
|
||||
<!-- End Return Code -->
|
||||
|
||||
<!-- Buttons -->
|
||||
<div
|
||||
class="row pt-5 text-center"
|
||||
style="cursor: pointer; height: 20%"
|
||||
>
|
||||
<div class="col-6">
|
||||
<a onclick="run_init()" class="btn">
|
||||
<span>Run</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button
|
||||
onclick="submit()"
|
||||
class="btn"
|
||||
data-toggle="modal"
|
||||
data-target="#modal"
|
||||
>
|
||||
<span>Submit</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Buttons -->
|
||||
</div>
|
||||
<!-- End Console -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- End First Test -->
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div
|
||||
class="modal fade"
|
||||
id="modal"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
aria-labelledby="exampleModalCenterTitle"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2
|
||||
class="modal-title"
|
||||
id="exampleModalLongTitle"
|
||||
style="color: black"
|
||||
>
|
||||
Results
|
||||
</h2>
|
||||
<button
|
||||
type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Close"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h5 id="result" style="color: black"></h5>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="index.php?action=goToNext&num=7" class="btn" style="display: none" id="next">
|
||||
<span>NEXT</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Modal -->
|
||||
|
||||
<script
|
||||
src="https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script
|
||||
src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script src="View/src/JS/base.js"></script>
|
||||
<script src="View/src/JS/FirstFunction.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,160 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>First Test</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
|
||||
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
||||
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
|
||||
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<link rel="stylesheet" href="View/src/CSS/FirstTest.css" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark pb-5">
|
||||
<div class="container-fluid mx-0">
|
||||
<div class="nav-item nav-link">
|
||||
<a class="navbar-brand" href="index.php?action=goToHome">Home</a>
|
||||
</div>
|
||||
<div class="mx-auto d-flex">
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #fff; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
Test de qualification
|
||||
</h5>
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #44fff6; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
7/10
|
||||
</h5>
|
||||
</div>
|
||||
<div class="nav-link">
|
||||
<a class="navbar-brand" href="index.php?action=goToNext&num=8">Next</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<!-- First Test -->
|
||||
<div
|
||||
class="row rounded p-3 m-3"
|
||||
style="
|
||||
background: #16222a; /* fallback for old browsers */
|
||||
background: -webkit-linear-gradient(
|
||||
to right,
|
||||
#3a6073,
|
||||
#16222a
|
||||
); /* Chrome 10-25, Safari 5.1-6 */
|
||||
background: linear-gradient(to right, #3a6073, #16222a);
|
||||
"
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<section
|
||||
style="background-color: #222831; min-height: 0"
|
||||
class="p-3 rounded m-0">
|
||||
<p>
|
||||
Il est temps de passer au niveau supérieur et de parler des conditions<br/>
|
||||
En python une condition est une instruction qui permet de vérifier si une condition est vraie ou fausse.<br/>
|
||||
Pour cela on utilise les mots clés if, elif et else. if signifie si, elif signifie sinon si et else signifie sinon.<br/>
|
||||
Voici un exemple :
|
||||
</p>
|
||||
<code style="font-size: 18px">
|
||||
a = 1; b = 2;<br/>
|
||||
if (a > b) :<br/>
|
||||
print(a,"est plus grand que",b)<br/>
|
||||
elif (a == b):<br/>
|
||||
print("a et c sont éguax")<br/>
|
||||
else :<br/>
|
||||
print(b,"est plus grand que",a)
|
||||
</code>
|
||||
<br></br>
|
||||
<p>
|
||||
Ici on test si a est plus petit que b.<br/>
|
||||
Si a n'est pas plus petit alors on test si a est égal a b.<br/>
|
||||
Si aucune des conditions est remplit alors on affiche "a est plus grand que b".
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-2 align-self-center">
|
||||
<img
|
||||
src="View/assets/img/Foxy.png"
|
||||
alt="Logo"
|
||||
class="img-fluid rounded-circle"
|
||||
style="
|
||||
border: 2px solid #44fff6;
|
||||
background-image: url('View/assets/img/BackgroundMain.jpg');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-5">
|
||||
<!-- Editor -->
|
||||
<div class="col-8">
|
||||
<div class="ace rounded ace-1" id="editor" style="min-height: 40vh">a = 1; b = 2;
|
||||
if (a > b) :
|
||||
print(a,"est plus grand que",b)
|
||||
elif (a == b):
|
||||
print("a et c sont éguax")
|
||||
else :
|
||||
print(b,"est plus grand que",a)</div>
|
||||
</div>
|
||||
<!-- End Editor -->
|
||||
|
||||
<!-- Console -->
|
||||
<div class="col-4" style="min-height: 40vh">
|
||||
<textarea
|
||||
id="console"
|
||||
readonly
|
||||
style="width: 100%; height: 60%"
|
||||
class="p-3 rounded"
|
||||
></textarea>
|
||||
<!-- End Return Code -->
|
||||
|
||||
<!-- Buttons -->
|
||||
<div
|
||||
class="row pt-5 text-center"
|
||||
style="cursor: pointer; height: 20%"
|
||||
>
|
||||
<div class="col">
|
||||
<a onclick="run_init()" class="btn">
|
||||
<span>Run</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Buttons -->
|
||||
</div>
|
||||
<!-- End Console -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- End First Test -->
|
||||
</div>
|
||||
<script
|
||||
src="https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script
|
||||
src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script src="View/src//JS/base.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,214 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>First Test</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
|
||||
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
||||
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
|
||||
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<link rel="stylesheet" href="View/src/CSS/FirstTest.css" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark pb-5">
|
||||
<div class="container-fluid mx-0">
|
||||
<div class="nav-item nav-link">
|
||||
<a class="navbar-brand" href="index.php?action=goToHome">Home</a>
|
||||
</div>
|
||||
<div class="mx-auto d-flex">
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #fff; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
Test de qualification
|
||||
</h5>
|
||||
<h5
|
||||
class="m-1 text-uppercase"
|
||||
style="color: #44fff6; font-weight: bold; font-size: 22px"
|
||||
>
|
||||
8/10
|
||||
</h5>
|
||||
</div>
|
||||
<div class="nav-link">
|
||||
<a class="navbar-brand" href="#" style="color: gray;">Next</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<!-- First Test -->
|
||||
<div
|
||||
class="row rounded p-3 m-3"
|
||||
style="
|
||||
background: #16222a; /* fallback for old browsers */
|
||||
background: -webkit-linear-gradient(
|
||||
to right,
|
||||
#3a6073,
|
||||
#16222a
|
||||
); /* Chrome 10-25, Safari 5.1-6 */
|
||||
background: linear-gradient(to right, #3a6073, #16222a);
|
||||
"
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-10">
|
||||
<section
|
||||
style="background-color: #222831; min-height: 0"
|
||||
class="p-3 rounded m-0">
|
||||
<p>
|
||||
Mettons en pratique ce que tu vient d'apprendre. Crée une fonction <b style="color : violet"> condition</b>
|
||||
qui prend en argument une liste de nombre entier et un nombre x.
|
||||
Et qui parcoure la liste en effectuant plusieurs tests :<br />
|
||||
<ul>
|
||||
<p>Si le nombre dans la liste est égal à 1, ajoute 1 à x</p>
|
||||
<p>Si le nombre dans la liste est différent de 2, soustrait 1 à x</p>
|
||||
<p>Si le nombre dans la liste est inférieur à 3, multiplie x par elle même</p>
|
||||
<p>Si le nombre dans la liste est supérieur à 6, ajoute 4 à x</p>
|
||||
<p>Sinon ajoute 5 à x</p>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
Pour parcourir une liste tu peux utlisier l'instruction <b style="color:violet">for</b> comme ceci :<br />
|
||||
</p>
|
||||
<code style="font-size: 18px">
|
||||
b = 0<br />
|
||||
for i in list :<br />
|
||||
if(i == 1):<br />
|
||||
b += 1
|
||||
</code>
|
||||
<br></br>
|
||||
<p>
|
||||
Elle va parcourir la liste et mettre dans la variable i chaque élément de la liste.
|
||||
Ici elle va parcourir la liste en asignant a i chaque élément de la liste un par un.
|
||||
Et pour chaque élément de la liste elle va ajouter 1 à la variable b.
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-2 align-self-center">
|
||||
<img
|
||||
src="View/assets/img/Foxy.png"
|
||||
alt="Logo"
|
||||
class="img-fluid rounded-circle"
|
||||
style="
|
||||
border: 2px solid #44fff6;
|
||||
background-image: url('View/assets/img/BackgroundMain.jpg');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-5">
|
||||
<!-- Editor -->
|
||||
<div class="col-8">
|
||||
<div class="ace rounded ace-1" id="editor" style="min-height: 40vh">def condition(list,a) :
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Editor -->
|
||||
|
||||
<!-- Console -->
|
||||
<div class="col-4" style="min-height: 40vh">
|
||||
<textarea
|
||||
id="console"
|
||||
readonly
|
||||
style="width: 100%; height: 60%"
|
||||
class="p-3 rounded"
|
||||
></textarea>
|
||||
<!-- End Return Code -->
|
||||
|
||||
<!-- Buttons -->
|
||||
<div
|
||||
class="row pt-5 text-center"
|
||||
style="cursor: pointer; height: 20%"
|
||||
>
|
||||
<div class="col-6">
|
||||
<a onclick="run_init()" class="btn">
|
||||
<span>Run</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button
|
||||
onclick="submit()"
|
||||
class="btn"
|
||||
data-toggle="modal"
|
||||
data-target="#modal"
|
||||
>
|
||||
<span>Submit</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Buttons -->
|
||||
</div>
|
||||
<!-- End Console -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- End First Test -->
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div
|
||||
class="modal fade"
|
||||
id="modal"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
aria-labelledby="exampleModalCenterTitle"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2
|
||||
class="modal-title"
|
||||
id="exampleModalLongTitle"
|
||||
style="color: black"
|
||||
>
|
||||
Results
|
||||
</h2>
|
||||
<button
|
||||
type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Close"
|
||||
>
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h5 id="result" style="color: black"></h5>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="index.php?action=goToNext&num=9" class="btn" style="display: none" id="next">
|
||||
<span>NEXT</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Modal -->
|
||||
|
||||
<script
|
||||
src="https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script
|
||||
src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
<script src="View/src/JS/base.js"></script>
|
||||
<script src="View/src/JS/If.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"bootstrap": "^5.2.2",
|
||||
"bootstrap-icons": "^1.10.2"
|
||||
"bootstrap-icons": "^1.10.2",
|
||||
"events": "^3.3.0"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue