Exercice Python (Code Citoyen)
Hello everyone,
I'm a student and I've just discovered Citizen Code Python www.futureenginer.fr
It's a pretty interesting game to get started with Python.
However, I'm unable to solve (in Python mode) the exercise Season 1 Episode 3 activity 5: The Scene in less than 30 lines.
Can you help me please?
Thank you
1 réponse
Hello,
Can you report the statement to us, show us what you’ve done, and tell us what’s blocking you?
In general, if you want to write code concisely, you should avoid repetition by refactoring the code. If you start copying and pasting lines of code, it’s usually a bad sign.
Here are some general tips that might help you achieve your goal. To refactor code, there are several strategies:
- Use loops (to repeat an arbitrary number of times an arbitrary process).
- Create functions (to share a block of code useful in several places) or reuse existing functions (for example, those provided by the modules available in the language or by third-party projects).
Good luck