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

where does halloween rank in popularity among commercial
Area of a square is 81cm. Find the perimeter in cm.
Which revision best uses subordinating conjunctions to clarify the meaning of this passage? Siobhan couldn't figure out how to end the short story she was writi
Help pls :) thanks!!!!!
Solve pls brainliest
Plz help I don not understand how they got these options.
(4) The volume of a cuboid shaped tank is 3600 cm?. Its height, breadth and length are three consecutive perfect squares. Find its length, breadth and height. (
Someone plz help me :(
please help i dont understand this
The sum of two numbers, x and y, is 12. The difference of four times the larger number and two times the smaller number is 18. Which system of equations should