J'aimerai faire matrix en python mais je n'y arrive pas.

Résolu
Multi73 Messages postés 95 Statut Membre -  
Multi73 Messages postés 95 Statut Membre -
Bonjour,
J'aimerai faire matrix en python mais je n'y arrive pas.
Voici mon programme.
import time
import os.system
os.system("color a")
x=1
while x = 1
    print(%random%%random%%random%%random%%random%%random%%random%%random%)


Pouvez vous m'aidez svp ?

2 réponses

  1. jee pee Messages postés 31872 Date d'inscription   Statut Modérateur Dernière intervention   9 977
     
    Bonjour,

    Tu devrais reprendre le cours Python au début ;-)

    x=1 affectation
    x==1 test égalité

    puis un bloc (if,while, def ...) a une ligne titre qui se termine par : donc
    while x==1:


    puis pas besoin d'une variable x, on peut faire une boucle infinie :
    while True:


    %random% c'est une variable MSDOS/ligne de commande, dans Python ce sera :

    import os
    import random
    os.system("color a")
    while True:
        print(random.randint(0,9),random.randint(0,9),random.randint(0,9),random.randint(0,9),random.randint(0,9),random.randint(0,9))


    ou un truc batard
    import os
    import random
    os.system("color a")
    while True:
        os.system('echo %random% %random% %random% %random% %random% %random% %random% %random%')


    mais alors autant faire du msdos, pas du python
    0
  2. Multi73 Messages postés 95 Statut Membre 2
     
    Ok merci beaucoup !
    0