Python Forum
All possible products of 3 discrete numbers.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
All possible products of 3 discrete numbers.
#1
Sorry if this is not the appropriate place to post this.

The next Olympics will feature the sport of climbing for the first time, with a novel scoring system that takes into account your placement out of 20 in 3 disciplines and ranks you by multiplying your 3 placements (lowest score wins). So the best possible score is 1*1*1 = 1 and the worst possible score is 20*20*20 = 8000.

I am wanting a list of all possible scores (which I believe is 20 choose 3 = 1140), and beside each score the three factors of the product.

I am not much of a coder but I figured this would be easy for someone who knows even a little Python and I would be interested in what the code looks like.
Reply
#2
We're not big on writing code for people here, but we would be happy to help you fix your code when you run into problems. When you do run into problems, please post your code in Python tags, and clearly explain the problem you are having, including the full text of any errors.

Note that it would not be 20 choose 3. That would ignore any scores where two or more of the categories had the same score. You could easily do this with three loops, and with the itertools package you wouldn't even need the loops.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  why does VS want to install seemingly unrelated products? db042190 3 608 Jun-12-2023, 02:47 PM
Last Post: deanhystad
  Generate Cartesian Products with Itertools Incrementally CoderMan 2 1,812 Jun-04-2020, 04:51 PM
Last Post: CoderMan
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 3,667 May-09-2019, 12:19 PM
Last Post: Pleiades

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020