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

i will mark you brainlist answer the following
Ramirez Corporation sells two types of computer chips. The sales mix is 30% (Q-Chip) and 70% (Q-Chip Plus). Q-Chip has variable costs per unit of $60 and a sell
What would be a good historical image to use?
What is the volume of a triangular prism with a height of 3 inches a base of 12 inches and a length of 5 inches?
21. Given below are lease terms at the local dealership. Terms: • Length of lease = 36 months • MSRP of the car = $22,500 • Purchase value of the car after leas
The stockholders' equity section on the December 31, 2012, balance sheet of Chemfast Corporation reported the following amounts: Contributed Capital Prefe
3x + 5y = 7 -3x - 2y = -1
What does exchange ratio mean? A. quantity to be replaced B. quantity for hoarding C. quantity for transaction D. quantity to be sold
Who was Ronald Reagan’s VP
What is the result of subtracting the second equation from the first? - 2x + 7y = 10 3x+ 7y = 2