Write a function called print_kth_top_movie_year. It should take a single argument, the rank of the year (like 2, 3, or 5 in the above examples). It shouldn't have a return statement.

Respuesta :

Answer:

Hi Rmarie! The question is asking for a simple function implementation without using a return statement. Please find the answer below.

Explanation:

The answer is easily implemented in Python. I have used Python 2.7, and included code for user to input a movie rank when the program is run. You can paste the code below into a file called top_movie_year.py and run it from the command line as "python top_movie_year.py".

top_movie_year.py

def print_kth_top_movie_year(rank):

 print(rank);

rank = raw_input("Enter movie rank: ");

try:

 rank = int(rank);

 while rank <= 0:

   print("Input a valid number: ")

   rank = raw_input("Enter a movie rank: ");

 print_kth_top_movie_year(rank);

except ValueError:

 print("Invalid input!");