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

Highest common factor of 240 and 432
why do the us government intervene in the economy during the finanacial crisis in 2008
Compare 1.6 square meters and 16 tenths square meters
what types of climate receives the smallest amount of rainfall?
How to solve 7x2+5-2x-3+5
During February, Kevin will water his ivy every third day, and water his cactus every fifth day. On which date will Kevin first water BOTH plants together?
How to solve 7x2+5-2x-3+5
The 24 students in Mr. Brown's homeroom sold 72 magazine subscriptions. The 24 students in Mrs. Garcia's homeroom sold 98 magazine subscriptions. Whose homeroom
You have already traveled east in your car 100km in 1hr and then south 100km in 2hrs. To get back home, you then drive west 100km for 3 hours and then go north
What's the scientific notation of 0.000000109