I'm not 100% sure about python performance with this, but it'd likely be faster if you drop the else and make the recursive call through a default return, like so:
def count_votes():
if biden.votes > trump.votes:
return declare_winner(biden)
return count_votes()
or maybe even like so though I hate this notation because it's a headache when reviewing:
def count_votes():
return declare_winner(biden) if biden.votes > trump.votes else count_votes()
I'm not 100% sure about python performance with this, but it'd likely be faster if you drop the
elseand make the recursive call through a defaultreturn, like so:def count_votes(): if biden.votes > trump.votes: return declare_winner(biden) return count_votes()or maybe even like so though I hate this notation because it's a headache when reviewing:
def count_votes(): return declare_winner(biden) if biden.votes > trump.votes else count_votes()