0
What is the numbers in print stands for in this code. Please tell.
Because I don't understand it. https://code.sololearn.com/coNPK49TF0oj/?ref=app
1 Antwort
+ 7
a=str(212.03)
<a> contains a string value of number 212.03 -> "212.03"
print(a[1])
The number inside square brackets refer to index of character in string <a>
print(a[3])
The number inside square brackets refer to index of character in string <a>
The string <a> -> "212.03"
Here's the layout of the string
index 0 1 2 3 4 5
character 2 1 2 . 0 3
Index 1 points to '1'
Index 3 points to '.'
NOTES: Index is a zero based number sequence.