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

start at 1 create a pattern that multiplies each number by 2. stop when you have 5 numbers
how you does this you how to fine what equal one
what does prompt means
Some students have an identity, an interest, or talent that defines them in an essential way. If you are one of those students, then tell us about yourself
What is four sixth in whole numbers
the price s of a pair of shoes plus %5 sales tax
What does Dorothy take with her when she leaves the Wicked Witch’s castle?
Is anyone good with vectors????? If I am given vector v=5i+4j, and Line L with point with position vector 3i+2j, how do I find an equation for L in ax+by=c for
The speed limit is 25 miles per hour, but it seems that many of the cars are going faster. The city places 2 counter strips 360 feet apart in the lane closest t
Lynne used 3/8 cup of flour and 1/3 cup of sugar in a recipe. Which number below is a common denominator for 3/8 and 1/3 ?