codybrocs7001 codybrocs7001
  • 06-12-2017
  • Computers and Technology
contestada

Write a function swaparrayends() that swaps the first and last elements of the function's array parameter. ex: sortarray

Respuesta :

rsmith6559
rsmith6559 rsmith6559
  • 07-12-2017
def swapArrayEnds( array ):
    tmp = array[ len( array ) - 1 ]
    array[ len( array ) - 1 ] = array[ 0 ]
    array[ 0 ] = tmp


Answer Link

Otras preguntas

What evidence supports the reason? Check all that apply. Reason: Traditionally, the Nobel Prize in Literature has been awarded to writers of prose and poetry, w
Discuss the statement"silence is golden" in hundred words in relation to ethics in communicating at the workplace.​
f(0)=g(0) f(-2)=g(-2) f(0)=g(-2) f(-2)=g(0)
Imagine the United States only had two postage stamps, a 3 cent stamp and a 7 cent stamp. If you can put any number of stamps on an envelope that you want, what
Why can't we dig through the Earth?
Which claim does the author make in the article? Eating well is very difficult and requires big changes to one's diet. High blood pressure is easy to diagnose a
The San Andreas Fault is known for which of the following?
On a coordinate plane, 2 triangles are shown. The first triangle has points A (negative 2, 1), C (negative 4, 1), and B (negative 3, 4). The second triangle has
A unicycle wheel has a diameter of 20 inches. How many inches will the unicycle travel in 8 revolutions? Use π = 3.14 and round your answer to the nearest hundr
what does the phrase “When they go low, we go high” mean to you ?