Test Index

Python Revision Tour Get it on Google PlayDownload on the App Store CBSE Board Videos

© examsnet.com
Question : 69 of 102
Marks: +1, -0
Identify the valid Python identifier from the following :
[CBSE 2024 Compartment]
Solution:  
Concept:
Rules for a Python identifier:
1. It may contain letters (A-Z, a-z), digits (0-9) and the underscore (_) only.
2. It must not start with a digit.
3. It must not contain spaces or special characters such as @, #, $.
4. It must not be a keyword.
Explanation:
2user: starts with a digit, invalid.
user@2: contains @, invalid.
user_2: letters, underscore and digit, valid.
user 2: contains a space, invalid.
Answer:
Option C (user_2)
© examsnet.com
Advertisements
Go to Question: