I am working to recreate a dice game known as Knucklebones in Python as a fun personal project.
For the game logic, I need to multiply all matching values in a list and then add the remaining values.
Example 1:
numbers = [3, 3, 2]
This list should multiply both 3 and 3 together then add 2 for a total of 11.
Example 2:
numbers2 = [4, 4, 4]
This list should multiply 4 by 4 by 4 for a total of 64
Example 3:
numbers3 = [2, 4, 6]
Nothing should be multiplied in this list. All numbers should be added for a total of 12.
Can someone please help me with the logic surrounding this?