Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In the computer language Python, indicators must start with an upper-case letter

ID: 3909233 • Letter: I

Question

In the computer language Python, indicators must start with an upper-case letter, a lower-case

letter or an underscore. The initial character may stand alone, or it may be followed by any number of characters chosen from a set of 63 symbols (the 52 allowed for the initial character, plus the ten digits. Certain keywords (such as and,if,print, etc) are set aside and may not be used as indicators. In one implementation of Python, there are 29 such reserved words, and all are less than 9 character long. How many Python identifiers are there that are less than or equal to 8 characters in length?

Explanation / Answer

For 1st position, 52+1 = 53 characters are allowed followed by which 63 characters are allowed for the subsequent positions.Hence -

For length 8, number of identifiers possible = 53 * (63 * 63 * ........ 7 times) = 53 * 637 but given that there are 29 reserved words, of length < 9 hence these 29 words cannot be identifier.

Therefore number of identifiers that are less than or equal to 8 characters in length = 53 * 637 - 29

Hope i have answered your question satisfactorily.Leave doubts in comment section if any