-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday4.py
More file actions
52 lines (44 loc) · 1.65 KB
/
day4.py
File metadata and controls
52 lines (44 loc) · 1.65 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
48
49
50
51
52
#Dictionary: Unordered key-value pairs. Mutable.
student = {"name":"Riya Dhami",
"age":19,
"department":"Computer Engineering"}
print(f"Dictionary:{student}\n")
print(f"Student's name: {student['name']}")
print(f"Student's age: {student['age']}")
print(f"Student's department: {student['department']}")
#Binary sequence types:
byte_data = b"Hello"
print(f"Byte data is {byte_data}\n")
#Boolean type of data:
is_learning = True # bool: True or False
empty_value = None #None Type: repressents the absence of a value
print(f"Is Learning Active? {is_learning} | Missing Data marker: {empty_value}")
print("\n")
# --- 5. SWAPPING & DELETING ---
a, b = 10, 20
a, b = b, a # The 'Easy Python Way' to swap
print(f"Swapped: a={a}, b={b}")
temp_var = "I will be deleted"
del temp_var # Removes variable from memory
#Dictionary: Unordered key-value pairs. Mutable.
student = {"name":"Riya Dhami",
"age":19,
"department":"Computer Engineering"}
print(f"Dictionary:{student}\n")
print(f"Student's name: {student['name']}")
print(f"Student's age: {student['age']}")
print(f"Student's department: {student['department']}")
#Binary sequence types:
byte_data = b"Hello"
print(f"Byte data is {byte_data}\n")
#Boolean type of data:
is_learning = True # bool: True or False
empty_value = None #None Type: repressents the absence of a value
print(f"Is Learning Active? {is_learning} | Missing Data marker: {empty_value}")
print("\n")
# --- 5. SWAPPING & DELETING ---
a, b = 10, 20
a, b = b, a # The 'Easy Python Way' to swap
print(f"Swapped: a={a}, b={b}")
temp_var = "I will be deleted"
del temp_var # Removes variable from memory