Data Types in Python 6 Standard Data Types in P
Data Types in Python 6 Standard Data Types in P
Introduction
In this article, you’ll learn about Python Data
Types and their applications while we writing
the python programs in an optimized manner.
You will learn ranging from what they’re,
their syntax, and also see the examples to use
them in Programs. Python is a language that
needs no introduction. It’s incredibly
powerful, versatile, fast and it’s easy to find
out.
Python is one of the languages that’s
witnessing incredible growth and recognition
year by year. Python is an interpreted
programming language that is object-
oriented used for general-purpose
programming. In this article, we are going to
learn about different data types in the
python language.
Example:-
Python Code:
@Santhosh-Reddy1/…
Open on Replit
A Nix (beta) repl b…
0 Run 6
Example:-
b = 1.5
print(b, "is of type", type(b))
Output: 1.5 is of type
Example:-
c = 8+3j
print(c, "is a type", type(c))
Output: (8+3j) is a type
Example:-
Example:-
String1 = "Hello"
String2 ="World"
print(String1+String2)
Output: Hello World
Example:-
String1 = "Hello"
print(String1[2:4])
Output: llo
Repetition:
Example:-
Print(String1*5)
Output: HelloHelloHelloHelloHello
List1 = [3,8,7.2,"Hello"]
print("List1[2] = ", List[2])
Output: List1[2] = 7.2
print("List1[1:3] = ", List[1:3])
Output: List1[1:3] = [8, 7.2]
List1[3] = "World"
#If we print the whole list, we can see
print(List1)
Output: [3, 8, 7.2, ‘World’]
Example:
Tuple = (25,10,12.5,"Hello")
print("Tuple[1] = ", Tuple[1])
Output: Tuple[1] = 10
print("Tuple[0:3] =", Tuple[0:3])
Output: Tuple[0:3] = (25,10,12.5)
Example:
Set = {4,3,6.6,"Hello"}
print(Set)
Output: {‘Hello’, 3, 4, 6.6}
Set[1] = 12
Output: TypeError
Syntax:
Key:value
Example:
Example:
print(Dict[2])
Output: 5.5
Example:
Dict[3] = 'World'
print(Dict)
Output:
{1: ‘Hello’, 2: 5.5, 3: ‘World’}
Conclusion
If you’re reading this text, you’re probably
learning Python or trying to become a
Python developer. Learning Python or the
other programing language begins by
understanding the concepts that are a basic
part of its foundation.
Hope you want to have understood the
varied classifications of Python Data Types
by now, from this text .
About The Author
Prashant Sharma
Currently, I Am pursuing my Bachelors of
Technology( B.Tech) from Vellore Institute of
Technology. I am very enthusiastic about
programming and its real applications
including software development, machine
learning, and data science.
Related
Introduction to Python
Programming
(Beginner’s Guide)
Prashant Sharma
Currently, I Am pursuing my Bachelors of
Technology( B.Tech) from Vellore Institute of
Technology. I am very enthusiastic about
programming and its real applications
including software development, machine
learning and data science.
Download
Analytics Vidhya App for the Latest
blog/Article
Next Post
Leave a Reply
Your email address will not be published.
Required fields are marked *
Comment
Name*
Email*
Website
Submit
Top Resources