traverseed1pont.py

Created by niz-moussatat

Created on February 14, 2022

673 Bytes

Script à compléter.


from random import randint
def traverse() :
  x , y = 0 , 0      # point de départ est l'origine du repère
  while False and  False and False :
    i = randint(1,4)  # choisir au hasard un entier entre 1 et 4
    if i == 1 :
      x = x - 1      # avancer vers la gauche
    elif i == 4 :
      x = x + 1      # avancer vers la droite
    else :
      x = x        # avancer droit
    y = y + 1         # avancer d'un pas
  if False and  False and False :
    return True      # traversée réussie 
  else :
    return False    # tombé à l'eau

def frequence() :
  compteur = 0
  for i in range(1) :
    if traverse() :
      print(1)
  return 0

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 cookies policy.