8. What is the output of the following code?
Code: Select all
str = "pynative"
print (str[1:3])
A. py
B. yn
C. pyn
D. yna
Because of the slice() function the anwer is B. But that's not my question. I thought it was odd that they used "str" as a variable. I wasn't even aware that you could use a built-in function as a variable. I would have thought that at a minimum this is poor coding practice. Am I missing something here?