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

Which statement illustrates the distributive property? Please help
What is a major city in Alaska that starts with F
What is the difference between preterite and imperfect and the past progressive and present progressive?
Water on each side of a divide flows in...
Rio grande river separates what Texas city from Mexico starts with E
Which statement illustrates the distributive property? Please help
Rio grande river separates what Texas city from Mexico starts with E
How do you tell if an equation is linear or not????
What is the difference between preterite and imperfect and the past progressive and present progressive?
What is 36 percent as a decimal?