#๐Ÿ”’ Hi, I have a problem with the print(color) in my script

28 messages ยท Page 1 of 1 (latest)

heady islandBOT
#

@old cobalt

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.

hazy osprey
#

!code

heady islandBOT
#
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.

old cobalt
#

?

#

i am a beginner and idk what i shoud do

sharp current
#

The couleur variable is only changed in line 17
That means it will always be the same when printing in line 24 or line 34, when you do the countdown thing

old cobalt
#

When i executed the script it is give me

#

3 red

#

2 red

#

1red

#

0 red

#

red

#

and i want

#

3

#

2

#

1

#

0

#

red

sharp current
# old cobalt red

So put the print(couleur) lines outside of the loops.

The space at the beginning of the line shows what is inside what. for loops in lines 22 and 32 have spaces in front of them.
Then ecrire(str(i)) has more spaces, meaning it's inside the that loop... And print(couleur) has the same number of spaces as ecrire(str(i)) meaning it's also inside the loop.

If you want print(couleur) to be outside of the loop, it needs to have exactly as many spaces as the for lines, not more

hazy osprey
sharp current
#

print(couleur) is at the red level. It's supposed to be at the orange level

sturdy elk
hazy osprey
old cobalt
#

sorry for the late i had to do something

heady islandBOT
#
Python help channel closed using Discord native close action

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.