#๐ how can i improve my code
8 messages ยท Page 1 of 1 (latest)
Hey @wary scarab!
Please edit your message to use a code block
Add a py after the three backticks.
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
@wary scarab
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.
Closes after a period of inactivity, or when you send !close.
There's not much code here, so there isn't much that can be commented on. A couple of things, though:
- This code can only generate two die at a time. Try to allow the user to pick how many die to roll each round (hint: you'll want a list and a loop)
- Try to incorporate your own functions. Once you do the above suggestion, make the "generate dice" logic its own separate function.
- Instead of calling
quit, you can instead justbreakfrom the loop. That will allow this logic to be more generally useful, since killing the entire program won't be a necessity.
- Allow the user to pick how many sides the die has instead of forcing a d6
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.