yiking.py

Created by elodie-gamot

Created on January 31, 2022

642 Bytes


from math import *
from random import *
from kandinsky import *

black = color(0,0,0)
white = color(255,255,255)
width=10
height=10

def hexa():
  
  L=[]
  for i in range(6):
    L.append([1,1,1,randint(0,1),1,1,1])
    L.append([0]*7)
  #Création d'une matrice de 12 lignes avec 7 
  #nombres (0 ou 1) par ligne. 
  
  for i in range(7):
    for j in range(12):
      if L[j][i]==0:
        fill_rect(5+i*height,5+j*width,width,height,white)
      else:
        fill_rect(5+i*height,5+j*width,width,height,black)
  #En parcourant la matrice, si la valeur rencontrée est un 0, le 
  #rectangle est blanc sinon il est noir.

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.