Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
NBA Stats Application
The Helper Function
6. Getting a parameter
Core Functions
Menu Functions
Putting it all together

Instruction

Excellent! Now we will ask the user to pick a specific parameter. Based on the user's choice, we'll either sort our players in a specific way or select the best player based on the given parameter.

Exercise

Create a function named get_param_from_user() that does the following:

  1. Prints a list of available parameters:
    >> 1. By height
    >> 2. By number of matches
    >> 3. By field goals (%)
    
  2. Asks the user for a number with the following prompt:
    >>> Your choice: 
  3. Returns the user input as an integer.

Assume that the user always provides a correct choice, i.e., an integer number from 1 to 3.

Stuck? Here's a hint!

To get user input, use the input() function. To convert the input to an integer, use int().