Menu

[Solved] Language Python Function Name Highscores Parameters String Float Returns List Tuple Descri Q37209017

Language: Python

Function name: highscores

Parameters : string, float

Returns: list of tuple

Description:

Given a float and a string of the form:
“{FirstName} {LastName}: {Score}; {FirstName} {LastName}: {Score};…”

Return a list containing the students who scored higher than orequal to the float passed in. The list should be in decreasingorder of scores and of the form:

[(1, {FirstName}), (2, {FirstName}), (3, {FirstName})…]

If an empty string is passed in or there are no students who gota score of at least the float passed in, then return an emptylist.

Test Cases :
>>> aStr = “Damian Henry: 8.8; Jakob Johnson: 20; CoryBrooks: 19; Caitlin Yang: 17; Christine Feng: 14”
>>> aFloat = 15.0
>>> test1 = highscores(aStr, aFloat)
>>> print(test1)
[(1, ‘Jakob’), (2, ‘Cory’), (3, ‘Caitlin’)]
>>> aStr = “Natalie Mueller: 18; Jack Wolfard: 15; TiffanyXu: 19”
>>> aFloat = 100.0
>>> test2 = highscores(aStr, aFloat)
>>> print(test2)
[]

Expert Answer


Answer to Language: Python Function name: highscores Parameters : string, float Returns: list of tuple Description: Given a float … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *