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

Determine if the graph is symmetric about the x-axis, the y-axis, or the origin. r = 2 cos 3θ
How would I solve this problem?
Which office supplies start with the letter o
How do you find v° and x using sine, cosine, and tangent?
The diagram illustrates which evolutionary concept? A) gene flow B) genetic drift C) allele jumping D) genetic specialization
how did germany react to the increased demand for weapons during ww2
A tank of water has a base a circle of radius 2 meters and vertical sides. If water leaves the tank at a rate of 4 liters per minute, how fast is the water leve
Please help with this
The room will be a cube with volume 4,913 cubic feet.What is tje length of the new room
Solve by completing the square x^2+4x=5