0% found this document useful (0 votes)
38 views1 page

PY Variable

The document explains the concept of variables in Python, defining them as containers for data. It covers data types, typecasting (both explicit and implicit), and provides examples of how to use built-in functions for type conversion. Additionally, it introduces the match case statement syntax for pattern matching in Python.

Uploaded by

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

PY Variable

The document explains the concept of variables in Python, defining them as containers for data. It covers data types, typecasting (both explicit and implicit), and provides examples of how to use built-in functions for type conversion. Additionally, it introduces the match case statement syntax for pattern matching in Python.

Uploaded by

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

Python

Variable:- Container that hold data


a = 1
b = True
c = "Harry"
d = None

DATA TYPES:-Data type specifies the type of value a variable holds


a = 1
print(type(a))
b = "1"
print(type(b))

TYPECASTING
conversion of one data type into other data type is known as typecasting or type
conversion in python

1)EXPLICIT TYPECASTING
The conversion of one data type into another data type, done via developer or
programmer's intervention or manually as per the requirement, is known as explicit
type conversion.
Python’s built in functions such as int(), float(), hex(), oct(), str(), etc are
used to do so

2)IMPLICIT TYPECASTING
here one data type is converted into other by python interpreter
itself(automatically)
accourding to the level of data types one data type is converted to an higher level

MATCH CASE STATEMENT


match variable_name:
case ‘pattern1’ : //statement1
case ‘pattern2’ : //statement2

case ‘pattern n’ : //statement n

You might also like