0
sides=random.choice([*range(3,10),360])

The purpose of this code is to pick a random number from 3, 4, 5, 6, 7, 8, 9, 10, 360.

khelwood
  • 55,782
  • 14
  • 81
  • 108
Ella
  • 11
  • 3
  • 1
    As for the brackets, [`choices`](https://docs.python.org/3/library/random.html#random.choice) takes a single argument. – Sayse Jan 05 '21 at 09:51
  • 1
    The brackets is to create a list and the asterisk is to unpack the range into the list. Basically, it's the same as `list_to_chose_from = [*range(3, 10), 360]` and then `sides = random.choice(list_to_chose_from)`. – Ted Klein Bergman Jan 05 '21 at 10:03
  • 1
    `range(3,10)` delivers 3-9 ... not 10. – Patrick Artner Jan 05 '21 at 10:55

0 Answers0