Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
9 views2 pages

All About Variables

A variable is a named container that stores values, which can change over time and can hold different data types. Key features include the ability to perform mathematical operations and the requirement for unique naming conventions. Rules for naming variables include starting with a letter or underscore, avoiding special characters, being case sensitive, and not using reserved words.

Uploaded by

Faiaz Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

All About Variables

A variable is a named container that stores values, which can change over time and can hold different data types. Key features include the ability to perform mathematical operations and the requirement for unique naming conventions. Rules for naming variables include starting with a letter or underscore, avoiding special characters, being case sensitive, and not using reserved words.

Uploaded by

Faiaz Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

A variable is a name that stores a value, like a container that holds information

Key features of Variables:

1. It stores data. (names, text, etc.)


2. Values can change anytime.
x=5
x = 10 {Previously x held 5 now its holding 10}
Each variable has unique names.
3. Can stores numbers which can be used in mathematical operations.
A=5
B=6
Sum = A + B
4. Can store different data types.

Rules for naming variables:

1. Variable names must start with a letter (a-z)/(A - Z) or an underscore (_)


Name = “Alice” variable
_name = “Alice” variable
1name = “Alice” not a variable
@name = “Alice” not a variable
2. Variable names must contain letters and numbers and underscore (_) but no special characters
like @#$%
na_me = “Alice” variable
age1 = 23 variable
age@ = 23 not a variable

3. Variable names are case sensitive (Uppercase and lowercase are different)
Name = “Alice”
name = “Bob”
4. No spaces are allowed in variable names. Use underscore(_) instead.
Full name = “Abrar Faiaz” not a variable
Full_name = “Abrar Faiaz” variable
5. Some words are used in python that are reserved words and have special meaning. Those
cannot be variable names.
False, None, True, and, break, class, for, from, if

You might also like