njdsbfjkc4992 njdsbfjkc4992
  • 23-01-2020
  • Computers and Technology
contestada

If the variable data refers to the string "No way!", then what does the expression data[-1] evaluate to

Respuesta :

flightbath flightbath
  • 23-01-2020

Answer:

'!'

Explanation:

In python, a string can be traversed from end very easily by using negative indexes, so, if index 0 points to the first element of the string, then, index -1 will point to the last element of the string, that is why, when data[-1] is printed last element of data, which is '!' is printed. Also, it can take more parameters separated by a colon, which are end index and step.

Answer Link

Otras preguntas

________________ should be used when you want to illustrate a point and connect to the audience, and can be explanatory, exemplary, or persuasive. Be sure they
The Tragedy of Julius Caesar by William Shakespeare (Act 3, Scene 1) What does Mark Antony ask of the conspirators at the end of act 3, scene 1?
The lines whose equations are 2x + 3y = 4 and y=mx + 6 will be perpendicular when m is
The non-operational chain of command runs directly from the president to the secretary of defense and then to the _____.
I don't understand at all
Which of the following is true about calories? a. young children need more calories than adults. b. everyone's caloric needs differ. c. calories are measured
K2CrO4 type of atom ??
Please select the word from the list that best fits the definition the characteristic temperature at which a pure solid changes to a liquid is its ______ point.
In what ways are the harlem voices in langston hughes's poetry distinctive
Can anyone answer these?????