Login and get coding
PyBites is starting a campaign to try and pair up the highest ranking Ninjas with some of the lower ranking ones. Your task is to rank the given Ninjas according to their number of Bites.
We are going to delve into some Object Oriented Programming here because we want to retain state as we add more Ninjas to the
I have laid out the structure of the script for you. Your task is to flesh out the
Ninjaclass will have the following features:
==, based on
- print out in the following format:
Rankingsclass will have the following features:
add()that adds a Ninja object to the rankings
dump()that removes/dumps (and returns) the lowest ranking Ninja from Rankings
highest()returns the highest ranking
Ninja, but it takes an optional
countparameter indicating how many of the highest ranking Ninjas to return
lowest(), the same as highest but returns the lowest ranking Ninjas, also supports an optional
returns how many Ninjas are in Rankings when
len()is called on it
pair_up()method that pairs up study partners: the highest with the lowest
rankinginstance, then the second highest with the second lowest
rankingetc. It takes an optional count parameter indicating how many Ninjas to pair up (default =
Remember, that the standard library is your friend, best of luck!
132 out of 133 users completed this Bite.
Will you be Pythonista #133 to crack this Bite?
Resolution time: ~81 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 7.12 on a 1-10 difficulty scale.
» Up for a challenge? 💪