Why doesn’t parrot have quotes around it when being printed?
While it wouldn’t be invalid to type
len("parrot"), it would not be equivalent to
len(parrot). To print a variable, we don’t wrap it in quotes, we just write the name of the variable, and it provides whatever is contained inside of it to the
len( ) method. The difference would be
“parrot” instead of
For a better understanding, check out the code below:
my_bird = "penguin" print my_bird # prints “penguin” to the screen print "my_bird" # prints “my_bird” to the screen