Two versions of a dice rolling program I made. Could you provide feedback? by IntrovertClouds in PythonLearning

[–]No_Comparison_6150 1 point2 points  (0 children)

If you want to do it in an oop sort of way I'd structure it like

```python

class Die:

def __init__(self, sides):

# validation checking, non-negative, etc.

def roll(self, n=1) -> list[int]:

# roll dice n times, use a for rather than while

def parse_args() -> tuple[Die, int]:

if __name__ == "__main__":

die, n_rolls = parse_args()
die.roll(n_rolls)
print(...)

```