Skip to content

Commit 36a1ce7

Browse files
committed
Python Basic Concepts
1 parent 2ca61f9 commit 36a1ce7

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

basic concepts/data_types.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
""" This file is create and managed by Tahir Iqbal
2+
----------------------------------------------
3+
It can be use only for education purpose
4+
"""
5+
6+
# Python Data Types
7+
8+
# - Numbers / Float
9+
# - Strings
10+
# - Lists
11+
# - Tuples
12+
# - Sets
13+
# - Dictionaries
14+
# - Boolean
15+
# - Bytes
16+
17+
# print() - It is a built-in function that print or output the given data
18+
# type() - It is a built-in function that shows the variable type
19+
20+
# Number assign without any quotes and braces
21+
n = 10
22+
print(type(n))
23+
n1 = 20.5
24+
print(type(n1))
25+
26+
# Single and double quotes used for string values
27+
s = "I'm Tahir Iqbal"
28+
print(type(s))
29+
30+
# Square braces use for defining list object
31+
# Lists are mutable (Reassign / Changeable)
32+
l = ["Python", "Java", "JavaScript"]
33+
print(type(l))
34+
l2 = [10, 20, 30]
35+
print(type(l2))
36+
37+
# Parentheses use for defining tuple object
38+
# Tuples are immutable (Not changeable)
39+
t = ("Python", "Java")
40+
print(type(t))
41+
t1 = (10, 20, 30)
42+
print(type(t1))
43+
44+
# Use curly braces to defining a set
45+
set1 = {"Python", "Java", "C"}
46+
print(type(set1))
47+
set2 = {10, 20, 30}
48+
print(type(set2))
49+
50+
# Use curly braces to defining a dictionary
51+
# It requries (Key : Value) pair
52+
d = {"key": "Value", "language": "Python"}
53+
print(type(d))
54+
55+
# Boolean values are True and False
56+
v1 = True
57+
v2 = False
58+
print(type(v1))
59+
60+
# Bytes
61+
b = b"This is Tahir Iqbal"
62+
print(type(b))
63+
b1 = bytes(10)
64+
print(type(b1))

0 commit comments

Comments
 (0)