Exam PCAP All QuestionsBrowse all questions from this exam
Question 41

Which of the following words can be used as a variable name? (Choose two.)

    Correct Answer: C, D

    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.

Discussion
AtulVSharmaOptions: CD

C and D are correct answers

Valcon_doo_NoviSadOptions: CD

But it would be very unwise to call your variables like that :)

Ello2023Options: CD

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.

ArulkumarOptions: CD

for and True as reserved words . Ans : C & D https://realpython.com/lessons/reserved-keywords/

dicksonpwc

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

dicksonpwc

correct answer should be A and B

noobplayer

No these are reserved keywords in Python , you cannot use them as variable name

macxszOptions: CD

C. true D. For