We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

allan9395 • 4 years ago

Bonsoir
Y a t'il des corriger disponible

Cordialement

Anonymous • 1 year ago

idk

FactorSpeed • 2 years ago

Ex 1 :
function helloWorld(){
return "Hello World!";
}

Ex 2 :
function quiEstLeMeilleurProf() {
return "Le prof de programmation Web";
}

Ex 3 :
function jeRetourneMonArgument($Arg) {
return $Arg;
}

Ex 4 :
function concatenation($arg1, $arg2) {
return $arg1 . $arg2;
}

Ex 5 :
function concatenationAvecEspace($arg1, $arg2) {
return $arg1 . " " . $arg2;
}

Ex 6 :
function somme($int1, $int2) {
return $int1 + $int2;
}

Ex 7 :
function soustraction($int1, $int2) {
return $int1 - $int2;
}

Ex 8 :
function multiplication($int1, $int2) {
return $int1 * $int2;
}

Ex 9 :
function estIlMajeure($int) {
if($int >= 18) return true;
return false;
}

Ex 10 :
function plusGrand($int1, $int2) {
if($int1 > $int2) return $int1;
return $int2;
}

Ex 11 :
function plusPetit($int1, $int2) {
if($int1 < $int2) return $int1;
return $int2;
}

Ex 12 :
function plusPetit($int1, $int2, $int3) {
return min([$int1,$int2,$int3]);
}

Ex 13 :
function premierElementTableau($array) {
if(!is_null($array)) return $array[0];
return null;
}

Ex 14 :
function dernierElementTableau($array) {
if(!is_null($array)) return $array[count($array)-1];
return null;
}

Ex 15 :
function plusGrand($array) {
if(empty($array)) return null;
return max($array);
}

Ex 16 :
function plusPetit($array) {
if(empty($array)) return null;
return min($array);
}

Ex 17 :
function verificationPassword($string) {
if(strlen($string) >= 8) return true;
return false;
}

Ex 18 :
function verificationPassword($string) {
if(
strlen($string) >= 8 &&
preg_match("#[0-9].*#",$string) &&
preg_match("#[a-z].*#",$string) &&
preg_match("#[A-Z].*#",$string)
) return true;
return false;
}

Ex 19 :
function capital($string) {
switch($string) {
case'France': return 'Paris';
case'Allemagne': return 'Berlin';
case'Italie': return 'Rome';
case'Maroc': return 'Rabat';
case'Espagne': return 'Madrid';
case'Portugal': return 'Lisbonne';
case'Angleterre': return 'Londres';
default: return 'Inconnu';
}
}

Ex 20 :
function listHTML($string,$array) {
if(is_null($string) || empty($string)) return null;
if(is_null($array) || empty($array)) return null;
$titre = "<h3>" . $string . "</h3>";
$villes = "<ul>";
foreach($array as $key) {
$villes .= "<li>" . $key . "</li>";
}
$villes .= "</ul>";
return $titre . $villes;
}

Ex 21 :
function remplacerLesLettres($string) {
$string = str_replace(['e','i','o','E','I','O'], ['3','1','0','3','1','0'], $string);
return $string;
}

Ex 22 :
function quelleAnnee() {
$date = new DateTime();
return $date->format('Y');
}

Ex 23 :
function quelleDate() {
$date = new DateTime();
return $date->format('d/m/Y');
}

Ex 24 :
include './libraryToInclude.php';
function fonctionMagique() {
return fonctionDeMaLibrairie();
}

Ex 25 :

include './libraryToInclude.php';
function getUtilisateursAutorises() {
$users = getAllUtilisateurs();
$array = array();
print_r($users);
for($i = 0; $i < count($users); $i++) {
if(!$users[$i]->blocked && !empty($users[$i]->email) && $users[$i]->age >= 18) array_push($array,$users[$i]);
}
print_r($array);
return $array;
}

Anonymous • 3 years ago

is there any correction here ????

Mohamed Mekkaoui • 5 years ago

Maroc => Barbes
Portugal => Porto
o_O

Jergal • 5 years ago

Some racist and homophobic content in french version.
Capital of Maroc : Barbes
Ex 25, in the user list : disizcestpasdurapdepd @ gmail . com

[CG]Thibaud • 5 years ago

Indeed. I've created a pull request to the author.

Sarah_OA • 2 years ago

exercice 11:

function plusPetit($a,$b,$c)
{
if($a<$b)
{
if($a>$c)
{
return $c;
}
else{
return $a;
}
}else{
if($b<$c)
{
return $b;
}else
{
return $c;
}
}

}
____________________________
exercice 12:

function premierElementTableau(array $T)
{
if(empty($T))
{
return null;
}
return $T[0];
}
__________________________
exercice 13:

function premierElementTableau(array $T)
{
if(empty($T))
{
return null;
}
return $T[0];
}
__________________________
exercice 14:

function dernierElementTableau(Array $Tab)
{
if(empty($Tab))
{
return null;
}
return end($Tab);
}

________________________
exercice 15:

function plusGrand(Array $T)
{
if(empty($T))
{
return null;
}
for($i=0;$i<count($t);$i++) {="" if($t[$i]="">$T[$i+1])
{
return $T[$i];
}
}
}
_____________________
exercice 16:

function plusPetit(Array $T)
{
if(empty($T))
{
return null;
}
return min($T);
}
________________________
exercice 17:

function verificationPassword($val)
{
$val2 = strlen($val);
if($val2>=8)
{
return true;
}
else{
return false;
}
}
_________________________
exercice 18:

function verificationPassword($val)
{
$pattern1 = "#[0-9].*#";
$pattern2 = "#[A-Z].*#";
$pattern3 = "#[a-z].*#";
$val2 = strlen($val);
if(($val2>=8) && (preg_match($pattern1, $val)) && (preg_match($pattern2, $val)) && (preg_match($pattern3, $val)))
{
return true;
}

return false;

}
_____________________
exercice 19:

function capital($str)
{
Switch($str)
{
case 'France' :
return 'Paris';
break;
case 'Allemagne' :
return 'Berlin';
break;
case 'Italie':
return 'Rome';
break;
case 'Maroc' :
return 'Rabat';
break;
case 'Espagne':
return 'Madrid';
break;
case 'Portugal':
return 'Lisbonne';
break;
case 'Angleterre':
return 'Londres';
break;
default:
return 'Inconnu';
}
}

JaimeSastre • 5 years ago

Hello I finished the test, was funny. Something to do after?
Thanks

Mehdi.R • 1 year ago

exercice 21
function remplacerLesLettres($str)
{
for($i = 0; $i < strlen($str); $i++)
{
if($str[$i] == 'e')
{
$str[$i] = '3';
}
else if($str[$i] == 'i')
{
$str[$i] = '1';
}
else if($str[$i] == 'o')
{
$str[$i] = '0';
}
echo $str[$i];
}
return $str;
}

Alex_ALPHA • 1 year ago

Exercice 23, Quelle année

function quelleAnnee()
{
$annee = getdate(date('year'));
echo $annee;
}

Alex_ALPHA • 1 year ago

Exercice 21, remplacer lettres

function remplacerLesLettres(string $Note)
{
$Note3 = str_replace('e',3,$Note);
$Note1 = str_replace('i',1,$Note3);
$Note0 = str_replace('o',0,$Note1);
echo $Note0;
}

Alprod • 1 year ago

Ou Exo 13 :

function premierElementTableau($arr)
{
return array_shift($arr);
}

array_shift retourne null si il est vide

Alprod • 1 year ago

Sinon il y du regex bien chiant pour verifier le password

function verificationPassword($pass)
{
$match = preg_match('/(?=.*[a-z])(?=.*[A-Z])(?=.*\d)^[a-zA-Z\d]{8,}/', $pass);
if ( $match ) return true;

return false;
}

Anonymous • 2 years ago

function verificationPassword($arg){
if(strlen($arg)>=8 && (preg_match('/[0-9]/', $arg)) && (preg_match('/[A-Z]/', $arg)) && (preg_match('/[a-z]/', $arg)) ){
return true;

}
return false;
}

Anonymous • 2 years ago

Les questions de multiplications, soustractions et additions sont bugées, car on a juste besoin de changer le nom de la fonction par le nom demandé ex : si on est sur l'exercice soustraction, il suffit de copier son code de multiplication de le coller et de ne changer que le nom de la fonction par soustraction. Il faudrait le patch si possible, même si ce n'est pas une grosse erreur, cela peut induire en erreur pour les débutants. Plus précisément de la question 7 à 12 il suffit juste de copier coller le code et de changer le nom de la fonction

khedhri • 2 years ago

le checker refuse la solution je ne sais pas pourquoi(task 21)

Kusuuo • 2 years ago

Exercice 18 :

function verificationPassword($mdp)
{
if (
(8 <= strlen($mdp))
&&
(preg_match('/[A-Z]/', $mdp))
&&
(preg_match('/[a-z]/', $mdp))
&&
(preg_match('/[0-9]/', $mdp))
)
{
$res = true;
}
else
{
$res = false;
}
return $res;
}

Thodler • 2 years ago

Pour l'exercice 20 mon code fonctionne mais n'est pas validé sur le site:

php
function listHTML(string $title = null, array $list = null){
$result = [];
if(isset($title) && isset($list)){
foreach($list as $element){
$result[] = '<li>'.$element.'</li>';
}
return '<h3>'.$title.'</h3><ul>'.implode($result).'</ul>';
}else{
return null;
}
}

Sarah_OA • 2 years ago

exercice 25 : 404 not found
y'a aucune explication!!!!

Sorel_bob • 1 year ago

blocked && !empty($listUsers[$i]->email) && $listUsers[$i]->age >= 18) array_push($array, $listUsers[$i]);

}
return $array;
}
?>

Sarah_OA • 2 years ago

exercice 20:

function listHTML($str,Array $T)
{
$res = "<h3>$str</h3><ul>";
for($i=0;$i<count($t);$i++) {="" $res="$res."&lt;li">$T[$i]</li>";
}

if(empty($T) || empty($str))
{
return null;
}
return $res."</ul>";
}
_____________________
exercice 21:

function quelleAnnee()
{
$mydate=getdate(date("U"));
return "$mydate[year]";
}

______________________
exercice 22:

function quelleAnnee()
{
$mydate=getdate(date("U"));
return "$mydate[year]";
}
_______________________
exercice 23:

function quelleDate()
{
return date("d/m/Y");
}
_______________________
exercice 24:

function fonctionMagique()
{
include "./libraryToInclude.php";
return fonctionDeMaLibrairie();
}

exercice 21:

function remplacerLesLettres($str)
{
$lettre = ["e","i","o"];
$remplacer = [3,1,0];
return str_ireplace($lettre,$remplacer,$str);
}

Sarah_OA • 2 years ago

exercice 6:
function somme($val1,$val2)
{
return $val1+$val2;
}
________________________
exercice 7:
function soustraction ($val1,$val2)
{
return $val1-$val2;
}
________________________
exercice 8:
function multiplication($a,$b)
{
return $a*$b;
}
_________________________
exercice 9:
function estIlMajeure($val)
{
if($val>=18)
{
return true;
}else
{
return false;
}
}
_________________________
exercice 10:
function plusGrand($a,$b)
{
if($a>$b)
{
return $a;
}
else
{
return $b;
}
}

Sarah_OA • 2 years ago

exercice 1:

function helloWorld()
{
return "Hello World!";
}

___________________
exercice 2:

function quiEstLeMeilleurProf()
{
return "Le prof de programmation Web";
}
____________________
exercice 3:

function jeRetourneMonArgument($val)
{
return $val;
}
_____________________
exercice 4:

function concatenation($val1,$val2)
{
$val0= $val1.$val2;
return $val0;
}
______________________
exercice 5:

function concatenationAvecEspace($val1,$val2)
{
return $val1.' '.$val2;
}

Agor White • 2 years ago

ps:

Il y a un bug a corriger, parce que si tu fais un simple code qui affiche dans la function nameDemander(){ echo true;} tout les testes son success mdr
celine • 2 years ago

Bonjour , comment peux t on avoir le corriger? merci d'avance

Anonymous • 2 years ago

comment peux on avoir la correction?

Anonymous • 3 years ago

exercice 21 : ma solution fonctionne mais codinggame la refuse

function remplacerLesLettres($chaine){
return strtr($chaine, 'eio', '310');
}

Mohamed_Maallem • 3 years ago

function remplacerLesLettres()
{
$input = "Les cours de programmation Web sont trops cools";
if (!empty($input)) {
echo str_replace(["L", "m", "d"], ["0", "2", "9"], $input);
}
}
echo remplacerLesLettres();

elidrissi randa • 1 year ago

function remplacerLesLettres(){
$arrFrom = array("e","i","o");

$arrTo = array("3","1","0");

$argument1 = "Bonjour les amis";

echo str_replace($arrFrom, $arrTo, $argument1);

}

coralsnake • 3 years ago

l'énoncer dit la variable est en argument et doit être retourné modifié et non afficher par "echo" , le site est bugé

Anonymous • 2 years ago

En fait il faut inclure les majuscules, dans ce cas :

return strtr($a, 'eioEIO', '310310');

muco • 1 year ago

ou ça

return str_ireplace(array('e', 'i','o'), array('3', 1,0), $a);