0% found this document useful (0 votes)
4 views

python2

The document explains the concept of variables and data types in programming, highlighting that variables are containers for storing values that can change. It details common data types such as String, Integer, Float, and Boolean, and provides examples for each type. Additionally, it describes the syntax for assigning values to variables in Python using the assignment operator.

Uploaded by

Prachi More
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)
4 views

python2

The document explains the concept of variables and data types in programming, highlighting that variables are containers for storing values that can change. It details common data types such as String, Integer, Float, and Boolean, and provides examples for each type. Additionally, it describes the syntax for assigning values to variables in Python using the assignment operator.

Uploaded by

Prachi More
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/ 3

7/27/24, 8:52 PM Revolutionizing the Job Market | NxtWave

Variables and Data Types


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

https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=6bdf14a9-2664-4a96-9764-89d965de71a0&s_id=abd72d9f… 1/3
7/27/24, 8:52 PM Revolutionizing the Job Market | NxtWave

Some Examples

"Hello World!"

"[email protected]"

"1234"

Note

The Stream of characters enclosed within quotes (Both single quotes and Double
quotes) are considered as strings.

'hello'

"hello"

Integer

All whole numbers (positive, negative and zero) without any fractional part come under Integers.
Examples

...-3, -2, -1, 0, 1, 2, 3,...

Float

Any number with a decimal point

24.3, 345.210, -321.86

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,

True and False are considered as Boolean values. Notice that both start with a capital letter.

https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=6bdf14a9-2664-4a96-9764-89d965de71a0&s_id=abd72d9f… 2/3
7/27/24, 8:52 PM Revolutionizing the Job Market | NxtWave

Assigning Value to Variable

The following is the syntax for assigning an integer value

10 to a variable age
PYTHON

1 age = 10

Here the equals to

= sign is called as Assignment Operator as it is used to assign values to variables.

https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=6bdf14a9-2664-4a96-9764-89d965de71a0&s_id=abd72d9f… 3/3

You might also like