Which of the following cannot be used as a variable? *
Priny
print
else
Answers
Answer: print, else
Explanation:
print is a function name
else is a keyword
function name and keywords cannot be used as variable names .
print and else cannot be used as a variable
Let's complete the question
Which of the following cannot be used as a variable?
else
Explanation
Print can be used as a variable but, not print. Print and print are two different things.
else
else cannot be used as a variable since it is a keyword.
print cannot be used as a variable since it is a function and is used to print statement.
Extra Information
Rules for variables/identifiers in Python language
1. Variable/Identifier name can start with a letter or underscore ( _ ) character only. It cannot start with a digit.
2. Python is a case-sensitive language which means variable/identifiers names are also case-sensitive.
Example - These three are different variables age, AGE, Age
3. Variable/Identifier names can only have alphanumeric characters (A-Z, a-z, and 0-9), and underscore ( _ )
Variable can be short or long/descriptive.
Example - x, y, z, age, gender, Address, _var, etc.
Note - Variable names can't have whitespaces, special characters such as !, #, %, etc. and variable names can't be a keyword/function that is reserved such as float, int, true, false, none, print, etc.
What is case sensitivity?
Case sensitivity is the term that tells us about the programming language capability of making out differences between Upper Case Letters(A, B, C, and so on) and Lower Case Letters (a, b, c, and so on).
Python was created by Guido van Rossum and came into existence in 1991. It is a high-level and general programming language. It is a very lucid programming language as it has a good language construct and object-oriented approach. It is dynamically typed and garbage-collected.