#🔒 to replace with the pointily in my code

22 messages · Page 1 of 1 (latest)

strange fjord
#

I have another problem I have understood the code a bit but I have trouble knowing what to replace with the pointily in my code I don't understand what I'm missing

class Chemin:

    def __init__(self, itineraire):
        self.itineraire = itineraire
        longueur, largeur = 0, 0
        for direction in self.itineraire:
            if direction == "D":
                longueur = longueur + 1
        if direction == "B":
            largeur = largeur +1
        self.longueur = longueur
        self.largeur = largeur
        self.grille = [['.' for i in range(longueur+1)] for j in 
    range(largeur+1)]



    def remplir_grille(self):
        i, j = 0, 0 # Position initiale
        self.grille[0][0] = 'S' # Case de départ marquée d'un S
        for direction in ...:
            if direction == 'D':
        ... = ... # Déplacement vers la droite
        elif direction == 'B':
        ... = ... # Déplacement vers le bas
        self.grille[i][j] = '*' # Marquer le chemin avec '*'
        self.grille[self.largeur][self.longueur] = 'E' # Case d'arrivée marquée d'un E

fiery plumeBOT
#

@strange fjord

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

cosmic geyser
#

!code

Please edit the post to mark off the code with code fences to preserve the formatting. @strange fjord

fiery plumeBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

strange fjord
#

it's ok ?

cosmic geyser
#

C'est bon.

#

Can you explain what the code is intended to do? Or the associated assignment question, if there is one?

strange fjord
#

yes I'll tell you right away wait 2 sec

#

Sorry the documents are in French

cosmic geyser
#

I have a little French.

strange fjord
#

ok

#

you look very competent

cosmic geyser
#

It looks like remplir_grille is intended to "execute" the itinery you supplied when you made the Chemin instance.

#

... and mark out the path on the grid.

#

So: can you complete any parts of it yet, or say where things are unclear?

Do you see how the grid is constructed in Chemin.__init__ and describe what it looks like then?

strange fjord
#

yes I think I understand better thank you

cosmic geyser
strange fjord
#

yes

fiery plumeBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.