Shaare your links...
59 links
IamBob Home Login RSS Feed ATOM Feed Tag cloud Picture wall Daily
Links per page: 20 50 100
page 1 / 1
15 results for tags lycee x
  • PHP
    <?php
    // Test de l’envoi du formulaire
    // L’alternative sera la présentation du formulaire
    // si la méthode GET est employéeif(!empty($_POST))
    {  
    if (!empty($_POST['login']) && !empty($_POST['password']))
    // Sont-ils ceux attendus ?
    if ($_POST['login'] != 'root'){
    { $errorMessage = 'Mauvais login !';
    }
    elseif ($_POST['password'] != '4242'){
    $errorMessage = 'Mauvais password !';
    }
      else {
    //suite.php en transmettant en paramètre
    header('Location: suite.php?login='.$_POST['login']);
    }
    }
    else{ $errorMessage = 'Veuillez insrire vos indentifiants svp !';
    }
    }
    ?>
    <!DOCTYPE html>
    <html>
    <body>
    <?php
    if (!empty($errorMessage)) echo $errorMessage;
    ?>
    <form action="authentification.php" method="post">
    <fieldset>
    <legent> identifiez-vous</legent>
    <label for="login">Login :</label>
     <input type="text" name="login" placeholder="bob" pattern=[a-z]{2,} required />
     <label for="password">Password :</label>
     <input type="password" name="password"/>
     <input type="submit" value="Se loguer"/>
    </fieldset>
    </form>
    </body>
    </html
    Tue 11 Feb 2020 05:34:32 PM CET - permalink -
    - http://l
    lycee
  • Javascript
    /* nom du fichier : script.je */
    function valiform() {
    let error=false;
    let textError;

    if(document.forms[myFrom]["nom"].value=""){
    error=true;
    textError="Erreur: veuillez remplir le champ Nom";
    }
    if(document.forms[myForm]["tel"].value.length!=0){
    error=true;
    textEroor="Erreur: veuillez remplur le champ Téléphone"
    }
    return !error;
    }
    Tue 14 Jan 2020 05:35:46 PM CET - permalink -
    - http://LOLmdrJuliette
    lycee
  • php
    <!DOCTYPE html>
    <html>
    <head>
    <title>Réponse au formulaire</title>
    <meta charset="utf-8">
    </head>
    <body>
    <h2>Votre formulaire à bien été envoyé</h2>
    <p>Bonjour <?php echo htmlspecialchars($_POST('prenom')); ?> ! </p>
    <p><script type="text/javascript">alert('formulaire envoyé')</script>
    </body>
    </html>
    Tue 14 Jan 2020 05:32:47 PM CET - permalink -
    - http://lolmdrnoé
    lycee
  • Dictionnaire
    mon_dico = {"Claude":"Nathan","Piere": "Alfonce", "date de naissance": "10/12/2003"}
    print(mon_dico)
    mon_dico['ville de naissance']= "Marseille"
    print(mon_dico)
    print("===================")
    print(f'À {mon_dico["ville de naissance"]}')
    mon_dico["age"]= "16"
    del mon_dico["date de naissance"]
    print(f' {mon_dico["age"]}')
    print(f'vous aurez bientot: {mon_dico["age"]}')
    Tue 17 Dec 2019 05:04:23 PM CET - permalink -
    - http://dico
    lycee python
  • Tridusacparquotien
    from time import *

    index_objet = [1,2,3,4,5,6,7,8,9,10]
    mass_objet = [5,4,7,6,1,3,2,8,9,10]
    prix_objet = [100,2,45,36,78,94,12,65,78,2]
    f_tab = []
    start = time()

    masse_sac = 0 #Masse totale du sac
    quo_objet = 0 #Quotient d'un objet de la liste mass_objet ou prix_objet
    quo_sac = [] #Liste de tout les quotients quo_objet
    indice_quotient = 0 #Indice du quotient d'un objet de la liste quo_sac
    prix_sac = [] #Prix total du sac

     
    while masse_sac <= 10 :
      quo_sac = []
      for i in range (0,len(mass_objet)) : # On rempli la liste quo_sac
          quo_objet = prix_objet[i]//mass_objet[i]
          quo_sac.append(quo_objet)
     
      max_quo=max(quo_sac) #Objet + gros quotient
      indice_quotient = quo_sac.index(max_quo) #Index de cet objet dans la liste des quotients des objets
      if masse_sac+mass_objet[indice_quotient] <= 10 :
          masse_sac = masse_sac+mass_objet[indice_quotient] # Ajoute la masse de cet objet dans une liste qui doit être < 10
          f_tab.append(index_objet[indice_quotient]) #Ajout de l'index de l'objet dans la liste finale
         
          prix_sac.append(prix_objet[indice_quotient]) #Ajout du prix de l'objet ajouté dans le prix total
         
          mass_objet.remove(mass_objet[indice_quotient])
          prix_objet.remove(prix_objet[indice_quotient])
          index_objet.remove(index_objet[indice_quotient])
       
      else :
          break
     
    end = time()

    print("Les index des objets à prendre sont : ",f_tab,"Le poids total du sac est", masse_sac, "et le prix :", prix_sac)
    print("Le temps est de : ", end-start)
    Tue 03 Dec 2019 04:17:38 PM CET - permalink -
    - ?SVe8UA
    lycee python
  • Algorythme de tri par selection
    def tri_selection(tab) :
      for i in range (0,len(tab)):
          mini = i
          for y in range (i+1,len(tab)):
              if tab[y] < tab[mini] :
                  mini = y
          if mini != i:
              temp=tab[i]
              tab[i]=tab[mini]
              tab[mini]=temp
      return


    from random import *

    mon_tab = []

    for element in range (0,10) :
      val=randint(0,100)
      mon_tab.append(val)


    tri_selection(mon_tab)
    print(mon_tab)
    Sat 16 Nov 2019 04:15:08 PM CET - permalink -
    - http://581
    lycee python
  • Algorythme de tri par bulle
    def tri_par_bulle(tab):
     n = len(tab)
     for i in range (n):
       for j in range (0, n-1):
        if tab[j] > tab[j+1] :
          tab[j], tab[j+1] = tab[j+1], tab[j]
     return

    from random import *
    mon_tab = []

    for i in range (0,10) :
       x = randint(0,100)
       mon_tab.append(x)

    tri_par_bulle(mon_tab)

    print(mon_tab)
    Fri 15 Nov 2019 10:56:49 PM CET - permalink -
    - http://cfdtrhy
    lycee python
  • Algorithme de tri par insertion
    def tri_insertion(tab):
      N = len(tab)
      for n in range(1,N):
          K = tab[n]
          j = n-1
          while j>=0 and tab[j] > K:
              tab[j+1] = tab[j]
              j = j-1
          tab[j+1] = K
      return

    from random import *
    mon_tab = []


    for i in range (0,10) :
      x=randint(0,100)
      mon_tab.append(x)
    tri_insertion(mon_tab)

    print(mon_tab)
    Fri 15 Nov 2019 10:08:31 PM CET - permalink -
    - http://5
    lycee python
  • BlackJack
    import os
    import random

    decks = input("Enter number of decks to use: ")

    # user chooses number of decks of cards to use
    deck = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]*(int(decks)*4)

    # initialize scores
    wins = 0
    losses = 0

    def deal(deck):
       hand = []
       for i in range(2):
           random.shuffle(deck)
           card = deck.pop()
           if card == 11:card = "J"
           if card == 12:card = "Q"
           if card == 13:card = "K"
           if card == 14:card = "A"
           hand.append(card)
       return hand

    def play_again():
       again = input("Do you want to play again? (Y/N) : ").lower()
       if again == "y":
           dealer_hand = []
           player_hand = []
           deck = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]*4
           game()
       else:
           print("Bye!")
           exit()

    def total(hand):
       total = 0
       for card in hand:
           if card == "J" or card == "Q" or card == "K":
               total+= 10
           elif card == "A":
               if total >= 11: total+= 1
               else: total+= 11
           else: total += card
       return total

    def hit(hand):
       card = deck.pop()
       if card == 11:card = "J"
       if card == 12:card = "Q"
       if card == 13:card = "K"
       if card == 14:card = "A"
       hand.append(card)
       return hand

    def clear():
       if os.name == 'nt':
           os.system('CLS')
       if os.name == 'posix':
           os.system('clear')

    def print_results(dealer_hand, player_hand):
       clear()

       print("\n    WELCOME TO BLACKJACK!\n")
       print("-"*30+"\n")
       print("    \033[1;32;40mWINS:  \033[1;37;40m%s   \033[1;31;40mLOSSES:  \033[1;37;40m%s\n" % (wins, losses))
       print("-"*30+"\n")
       print ("The dealer has a " + str(dealer_hand) + " for a total of " + str(total(dealer_hand)))
       print ("You have a " + str(player_hand) + " for a total of " + str(total(player_hand)))

    def blackjack(dealer_hand, player_hand):
       global wins
       global losses
       if total(player_hand) == 21:
           print_results(dealer_hand, player_hand)
           print ("Congratulations! You got a Blackjack!\n")
           wins += 1
           play_again()
       elif total(dealer_hand) == 21:
           print_results(dealer_hand, player_hand)
           print ("Sorry, you lose. The dealer got a blackjack.\n")
           losses += 1
           play_again()

    def score(dealer_hand, player_hand):
           # score function now updates to global win/loss variables
           global wins
           global losses
           if total(player_hand) == 21:
               print_results(dealer_hand, player_hand)
               print ("Congratulations! You got a Blackjack!\n")
               wins += 1
           elif total(dealer_hand) == 21:
               print_results(dealer_hand, player_hand)
               print ("Sorry, you lose. The dealer got a blackjack.\n")
               losses += 1
           elif total(player_hand) > 21:
               print_results(dealer_hand, player_hand)
               print ("Sorry. You busted. You lose.\n")
               losses += 1
           elif total(dealer_hand) > 21:
               print_results(dealer_hand, player_hand)
               print ("Dealer busts. You win!\n")
               wins += 1
           elif total(player_hand) < total(dealer_hand):
               print_results(dealer_hand, player_hand)
               print ("Sorry. Your score isn't higher than the dealer. You lose.\n")
               losses += 1
           elif total(player_hand) > total(dealer_hand):
               print_results(dealer_hand, player_hand)
               print ("Congratulations. Your score is higher than the dealer. You win\n")
               wins += 1

    def game():
       global wins
       global losses
       choice = 0
       clear()
       print("\n    WELCOME TO BLACKJACK!\n")
       print("-"*30+"\n")
       print("    \033[1;32;40mWINS:  \033[1;37;40m%s   \033[1;31;40mLOSSES:  \033[1;37;40m%s\n" % (wins, losses))
       print("-"*30+"\n")
       dealer_hand = deal(deck)
       player_hand = deal(deck)
       print ("The dealer is showing a " + str(dealer_hand[0]))
       print ("You have a " + str(player_hand) + " for a total of " + str(total(player_hand)))
       blackjack(dealer_hand, player_hand)
       quit=False
       while not quit:
           choice = input("Do you want to [H]it, [S]tand, or [Q]uit: ").lower()
           if choice == 'h':
               hit(player_hand)
               print(player_hand)
               print("Hand total: " + str(total(player_hand)))
               if total(player_hand)>21:
                   print('You busted')
                   losses += 1
                   play_again()
           elif choice=='s':
               while total(dealer_hand)<17:
                   hit(dealer_hand)
                   print(dealer_hand)
                   if total(dealer_hand)>21:
                       print('Dealer busts, you win!')
                       wins += 1
                       play_again()
               score(dealer_hand,player_hand)
               play_again()
           elif choice == "q":
               print("Bye!")
               quit=True
               exit()


    if __name__ == "__main__":
      game()
    Sat 09 Nov 2019 02:49:27 PM CET - permalink -
    - http://blacjkoazr
    commande lycee python
  • Les trois algorithmes de tri
    Tri par sélection :

    872149
    187249
    128749
    124879
    124789

    Tri par bulles :

    Étape 1.
    1.1. ( 5 1 4 2 8 ) {\displaystyle \to }\to  ( 1 5 4 2 8 ). Les nombres 5 et 1 sont comparés, et comme 5 > 1, l'algorithme les échange.
    1.2. ( 1 5 4 2 8 ) {\displaystyle \to }\to  ( 1 4 5 2 8 ). Échange, car 5 > 4.
    1.3. ( 1 4 5 2 8 ) {\displaystyle \to }\to  ( 1 4 2 5 8 ). Échange, car 5 > 2.
    1.4. ( 1 4 2 5 8 ) {\displaystyle \to }\to  ( 1 4 2 5 8 ). Pas d'échange, car 5 < 8.
    À la fin de cette étape, un nombre est à sa place définitive, le plus grand : 8.
    Étape 2.
    2.1. ( 1 4 2 5 8 ) {\displaystyle \to }\to  ( 1 4 2 5 8 ). Pas d'échange.
    2.2. ( 1 4 2 5 8 ) {\displaystyle \to }\to  ( 1 2 4 5 8 ). Échange.
    2.3. ( 1 2 4 5 8 ) {\displaystyle \to }\to  ( 1 2 4 5 8 ). Pas d'échange.
    5 et 8 ne sont pas comparés puisqu'on sait que le 8 est déjà à sa place définitive.
    Par hasard, tous les nombres sont déjà triés, mais cela n'est pas encore détecté par l'algorithme.
    Étape 3.
    3.1. ( 1 2 4 5 8 ) {\displaystyle \to }\to  ( 1 2 4 5 8 ). Pas d'échange.
    3.2. ( 1 2 4 5 8 ) {\displaystyle \to }\to  ( 1 2 4 5 8 ). Pas d'échange.
    Les deux derniers nombres sont exclus des comparaisons, puisqu'on sait qu'ils sont déjà à leur place définitive.
    Puisqu'il n'y a eu aucun échange durant cette étape 3, le tri optimisé se termine.
    Étape 4.
    4.1. ( 1 2 4 5 8 ) {\displaystyle \to }\to  ( 1 2 4 5 8 ). Pas d'échange.
    Le tri est terminé, car on sait que les 4 plus grands nombres, et donc aussi le 5e, sont à leur place définitive.

    Tri par insertion :

    Voici les étapes de l'exécution du tri par insertion sur le tableau [6, 5, 3, 1, 8, 7, 2, 4]. Le tableau est représenté au début et à la fin de chaque itération.

    .
    i = 1 :
    6 5 3 1 8 7 2 4
    ⟶
    5 6 3 1 8 7 2 4
    i = 2 :
    5 6 3 1 8 7 2 4
    ⟶
    3 5 6 1 8 7 2 4
    i = 3 :
    3 5 6 1 8 7 2 4
    ⟶
    1 3 5 6 8 7 2 4
    i = 4 :
    1 3 5 6 8 7 2 4
    ⟶
    1 3 5 6 8 7 2 4
    i = 5 :
    1 3 5 6 8 7 2 4
    ⟶
    1 3 5 6 7 8 2 4
    i = 6 :
    1 3 5 6 7 8 2 4
    ⟶
    1 2 3 5 6 7 8 4
    i = 7 :
    1 2 3 5 6 7 8 4
    ⟶
    1 2 3 4 5 6 7 8
    Fri 08 Nov 2019 09:28:44 AM CET - permalink -
    - http://Tri/Tri
    lycee python
  • eazjhousqhv
    #tableau de base pour afficher les carrés des nombres jusqu'à 11
    tab2=[element**2 for element in range(11)]
    print(tab2)

    #tableau valeur pair, montre les carrés des nombres pairs
    tab3=[element**2 for element in range(11) if element%2==0]#if p%2==0] (pour prendre les nombres pair et ==1 pour nombre impair)
    print(tab3)

    #longeur du tableau des carrés pairs
    longueur_tab3=len(tab3)

    #demander à l'utilisateur d'entrer une valeur de 0 à 100
    valeur=int(input("entrer un entier entre 0 et 100 :"))

    indice=-1
    for i in range (longueur_tab3):
    #for element in tab3:
      if(valeur==tab3[i]):
          indice=i
          break
     
    if(indice==-1):
      print("la valeur n'est pas dans le tableau")
    else:
      print("la valeur est dans la case ",indice+1)

    #j'ajoute des valeurs dans mon tableau
    tab3.append(16)
    tab3.insert(1,16)
    tab3.insert(-1,16)
    print(tab3)
         
    #tableau pour savoir si un nombre est dans le tableau
    tab=[]
    mon_tab=[p**2 for p in range (0,11)]
    x=int(input("entrer un nombre entre 0 et 100 inclus : "))
    if tab.count(x)>0:#count compte le nombre de fois ou x est présent dans le tableau si different de 0 alors présent
      print("le nombre est dans la case")
    else:
      print("non")

    valeur = int(input("Entrez la valeur à entrer : "))
    tab_occ = []
    for i in range (len(tab3)) :
     if (valeur == tab3[1]):
       tab_occ.append(i+1)
    print(tab3)
    print (f"Le nombre d'occurance de {valeur} est {len(tab_occ)} :", tab_occ)
     
    for i in range (len(tab3)) :
     maxi = max(tab3)
     mini = min(tab3)
    print (f"Le nombre minimun est {mini} et le nombre maximun est {maxi} :", tab3)
    #Sans utlilisé max et min ou peut faire :
    #mini = ta3[0]
    #for i in range (len(tab3)):
    # if mini>tab3[i]:
    #   mini=tab3[i]
    #print ("La valeur minimamle est : ", mini)
    Fri 08 Nov 2019 08:18:35 AM CET - permalink -
    - http://uygdo
    lycee python
  • les tab en une ligne
    mon_tab = [n**2 for n in range(0,11)]
    print (mon_tab)

    mon_tab = [n**2 for n in range(0,11) if n%2==0]
    print (mon_tab)

    mon_tab = [n**2 for n in range(0,11) if n%2==0]
    x=int(input("Entrer le nombre de votre choix : "))
    if mon_tab.count(x)>0 :
      print ("Votre nombre est compris dans le tableau")
    else :
     print("Votre nombre n'est pas compris dans le tableau")

    #Noélegenie
    Tue 05 Nov 2019 04:32:02 PM CET - permalink -
    - http://eazes
    commande lycee python
  • Python Sum
    Fri 18 Oct 2019 09:04:39 AM CEST - permalink -
    - https://www.programiz.com/python-programming/methods/built-in/sum
    commande lycee python
  • Python calcule de moyenne
    tab=[]
    print("Calcul de moyenne")
    n=int(input ("Quel est le nombre de note?"))
    for i in range (0,n):
       note=float(input("Entrer la note:"))
       tab.append(note)
    print(tab)
    #Ou alors on peut faire for i range (0,len(tab)
    #                        somme = somme + tab[i]
    #                       if n!=0 :
    #                        moyenne=somme/n
    m=sum(tab)/len(tab)
    print(m)


    Amlioration note entre 0 et 20

    tab=[]
    print("Calcul de moyenne")
    n=int(input ("Quel est le nombre de note?"))
    for i in range (0,n):
      note=float(input("Entrer la note:"))
      if note <= 20 :
        tab.append(note)
      else :
        print ("La note doit être comprise entre 0 et 20")
        note=float(input("Entrez la note:"))
        tab.append(note)
    print(tab)
    #Ou alors on peut faire for i range (0,len(tab)
    #                        somme = somme + tab[i]
    #                       if n!=0 :
    #                        moyenne=somme/n
    m=sum(tab)/len(tab)
    print("La moyenne est de :", m)
    Fri 18 Oct 2019 09:02:02 AM CEST - permalink -
    - http://pejr
    commande lycee python
  • Python lycee
    Les commandes


    STR= Permet de transforer une variable numerique en chaine de caractère ex b=2 Variable numerique stre(b) b="2")

    FSTRING Enchainer une chaine de caratere et des varibles dans une chaine de caractere' ex f' Chaine de caractere {variable}

    Tuples:

    Tuple x=(a,b,c,d) liste a correspond à x[1], b x[2]
    Len = len(x) indique le nombre de valeurs das le tuple

    exemple:
    def add(a,b):
    c = a + b
    return (a,b,c)
    mon_tuple = add(5, 8)
    print(f"{mon_tuple[0]} + {mon_tuple[1]} = {mon_tuple[2]}")
    Fri 18 Oct 2019 09:01:02 AM CEST - permalink -
    - http://zjaurgiu
    commande lycee python
Links per page: 20 50 100
page 1 / 1
Shaarli 0.0.41 beta - The personal, minimalist, super-fast, no-database delicious clone. By sebsauvage.net. Theme by idleman.fr.