30 Day code challenge-python
Day 7— Arrays
Task
Given an array, A, of N integers, print A’s elements in reverse order as a single line of space-separated numbers.
Input Format
The first line contains an integer, N(the size of our array).
The second line contains N space-separated integers that describe array A’s elements.
Output Format
Print the elements of array A in reverse order as a single line of space-separated numbers.
Explanation
Line 1: Gets the size of the array from the user
Line 2: Generates the elements in an array and splits the value after each empty spaces
Line 3: Reverse the elements
Line 4 and 5: Loops through the array and prints the value in reverse order
Bonus Tip: we can also use A[::-1] to reverse a list
See you on day 8