#๐ Hi, I have a problem with the print(color) in my script
28 messages ยท Page 1 of 1 (latest)
@old cobalt
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.
!code
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
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
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
Read. You're supposed to read.
this doesn't help his original query in any way
It does. Check the 2nd bullet point
As for the 3rd, he did that a bit later (this message: #1421562157476348115 message and onwards), but he still didn't post his code as text
sorry for the late i had to do something
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.