Skip to content
DeepForgeby svx
All problems

League Exploiter Fraction

Problem

Return the fraction of a league population made up of exploiters: exploiter_agents / (main_agents + exploiter_agents). An empty league returns 0.0.

Hint

Exploiters specialize in beating the current main agents to expose weaknesses.

Test cases

case 1
in: [10,5]
expected: 0.3333333333333333
case 2
in: [0,4]
expected: 1
case 3
in: [7,0]
expected: 0
case 4
in: [0,0]
expected: 0
Starter codePython
def league_exploiter_fraction(main_agents, exploiter_agents):
    # Your code here
    pass

4 test cases · run your code against them in the editor