recursion-tree-visualizer
recursion-tree-visualizer copied to clipboard
Interpreting strings as variables in python
For example, when I use a string "boy", I get an error boy not defined.
It is interpreting "boy" as a variable instead of a string.
But if I escape the quotes \"boy\" , it works.
Do you have some example function?
Do you have some example function?
literally any function that uses a string
I had the same issue [string] not defined, but using 'foo' instead of "foo" works.
For example, take a look at this simple string reverse function:
def fn(str):
if str == "": # this will not work unless you use single quotes insead of double quotes!
return "" # same problem
else:
return fn(str[1:]) + str[0]
fn("abc") # same problem
Fixed, thanks guys