Saved Bookmarks
| 1. |
Write the definition of a function Reverse(X) in Python, to display the elements in reverse order such that each displayed element is the twice of the original element (element * 2) of the List X in the following manner:Example:If List X contains 7 integers is as follows:X[0]X[1]X[2]X[3]X[4]X[5]X[6]48756210After executing the function, the array content should be displayed as follows:20 4 12 10 14 16 8 |
|
Answer» def Reverse (X): for i in range(len (X) -1, -1, -1): print x[i] *2 |
|