Variables
Variables are like containers for storing values. Values in the variables can be changed.
Values
Consider that variables are like containers for storing information. In context of programming, this information is often referred to as value.
Data Type
In programming languages, every value or data has an associated type to it known as data type. Some commonly used data types
- String
- Integer
- Float
- Boolean
This data type determines how the value or data can be used in the program. For example, mathematical operations can be done on Integer and Float types of data.
String
A String is a stream of characters enclosed within quotes. Stream of Characters
- Capital Letters ( A – Z )
- Small Letters ( a – z )
- Digits ( 0 – 9 )
- Special Characters (~ ! @ # $ % ^ . ?,)
- Space
Some Examples
- "Hello World!"
- "some@example.com"
- "1234"
Integer
All whole numbers (positive, negative and zero) without any fractional part come under Integers. Examples
Float
Any number with a decimal point
Boolean
In a general sense, anything that can take one of two possible values is considered a Boolean. Examples include the data that can take values like
- True or False
- Yes or No
- 0 or 1
- On or Off, etc.
As per the Python Syntax,
Assigning Value to Variable
The following is the syntax for assigning an integer value
Here the equals to