-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path05day.py
More file actions
47 lines (31 loc) · 1.33 KB
/
05day.py
File metadata and controls
47 lines (31 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# variables and data types in python
# variables are A Python variable is a symbolic name that is a reference or pointer to an object.
# Python Data Types are used to define the type of a variable
# Numeric data types: int, float, complex
# String data types: str
# Sequence types: list, tuple, range
# Binary types: bytes, bytearray, memoryview
# Mapping data type: dict
# Boolean type: bool
# Set data types: set, frozenset
a = complex(8, 2) # a contain variable
b = True # b contain boolean
c = "Harry" # c contain string
d = None # d contain numm
print(a)
print(b)
a1 = 9
print(a + a1)
print("The type of a is ", type(a))
print("The type of b is ", type(b))
print("The type of c is ", type(c))
############################################################################
# Lists are used to store multiple items in a single variable.
list1 = [8, 2.3, [-4, 5], ["apple", "banana"]]
print(list1)
# Tuples are used to store multiple items in a single variable. A tuple is a collection which is ordered and unchangeable.
tuple1 = (("parrot", "sparrow"), ("Lion", "Tiger"))
print(tuple1)
# A tuple is a collection which is ordered and unchangeable. A dictionary is a collection which is ordered*, changeable and do not allow duplicates.
dict1 = {"name":"Sakshi", "age":20, "canVote":True}
print(dict1)