Which of the following words can be used as a variable name? (Choose two.)
Which of the following words can be used as a variable name? (Choose two.)
In Python, variable names must adhere to certain rules. They cannot be reserved words (keywords) in the language. The words 'for' and 'True' are reserved keywords and thus cannot be used as variable names. The word 'true' is not a reserved keyword because it does not follow Python's capitalization for booleans, and 'For' is simply a capitalized version of 'for' and is therefore not a keyword. Consequently, both 'true' and 'For' can be used as variable names.
C and D are correct answers
But it would be very unwise to call your variables like that :)
C&D just like indentation capitalisation can also change the code. True and False are always capital. On the other hand for, and, in etc are lowercase.
for and True as reserved words . Ans : C & D https://realpython.com/lessons/reserved-keywords/
Correct answer should be A and B Python Reserved Words List - Your Complete Guide There is a restriction while naming identifiers that there are some restricted words that are built-in to Python which cannot be used as an identifier. Python reserved words (also called keywords) a predefined meaning and syntax in the language which Python uses for its syntax and internal processing. In this tutorial, we will discuss what those keywords are. Table of contents Reserved words Keywords Display all keywords Check if the name is included in the reserved word list Closing Thoughts Reserved words in Python Here is the list of all the reserved words in Python. Note - This list may change with different versions of Python. Python 3 has 33 while Python 2 has 30 reserved words. True elif in try and else is while as except lambda with assert finally nonlocal yield break for not class form or continue global pass
correct answer should be A and B
No these are reserved keywords in Python , you cannot use them as variable name
C. true D. For