11, New Entries


#1

This was part of what was in the console during this exercise. I just want to know about this part:

why "str(len(menu))" in order to print out the contents of the menu? Why wouldn't len(menu) suffice on its own? What's the "str" about?


#2

Did you try it?

You should. It will give you an error like:

Traceback (most recent call last):
  File "python", line 4, in <module>
TypeError: cannot concatenate 'str' and 'int' objects

See the last line - Python cannot + together a string and an integer.

Now can you see what str() does for you?


#3

Ah-- it creates a string so the two can be combined! thank you!