Question: Summary: In this lab, you complete a partially written Python program that reverses the order of five numbers stored in a list. The program should
Summary:
In this lab, you complete a partially written Python program that reverses the order of five numbers stored in a list.
The program should first print the five numbers stored in the array. Next, the program passes the array to a function where the numbers are reversed. Finally, the main program should print the reversed numbers.
The source code file provided for this lab includes the necessary variable assignments. Comments are included in the file to help you write the remainder of the program.
Instructions:
1. Make sure the file Reverse.py is selected and open.
2. Write the Python statements as indicated by the comments.
3. Execute the program by clicking the "Run Code" button at the bottom of the screen.
Assignment (Reverse.py):
""" Reverse.py - This program reverses numbers stored in an array. Input: Interactive. Output: Original contents of array and the reversed contents of the array. """
# Write reverseArray function here.
numbers = [9, 8, 7, 6, 5]
# Print contents of array.
# Call reverseArray function here.
# Print contents of reversed array.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
