Why str(len(menu))?


#1

I was wondering what was the purpose of str in line 12 str(len(menu)) ? And why it would not work with out str?

Sorry I know it is quite obvious but I am new to coding.


#2

One reason might be concatenation. We cannoit concatenate an integer to a string. len(menu)) is an integer. Converting to a string permits concatenation and/or string representation in formatting.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.