p$ is a string variable or not
Answers
Answer:
Yes
Explanation:
A string variable is a variable that holds a character string. It is a section of memory that has been given a name by the programmer. The name looks like those variable names you have seen so far, except that the name of a string variable ends with a dollar sign, $.
Variable name – Identifiers
Variable name is known as identifier. There are few rules that you have to follow while naming the variables in Python.
1. The name of the variable must always start with either a letter or an underscore (_). For example: _str, str, num, _num are all valid name for the variables.
2. The name of the variable cannot start with a number. For example: 9num is not a valid variable name.
3. The name of the variable cannot have special characters such as %, $, # etc, they can only have alphanumeric characters and underscore (A to Z, a to z, 0-9 or _ ).
4. Variable name is case sensitive in Python which means num and NUM are two different variables in python.
Python Variable Example
num = 100
str = "BeginnersBook"
print(num)
print(str)
Output:
Python variables