-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython
90 lines (64 loc) · 1.32 KB
/
python
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# DataType Output: str
x = "Hello World"
# DataType Output: int
x = 50
# DataType Output: float
x = 60.5
# DataType Output: complex
x = 3j
# DataType Output: list
x = ["geeks", "for", "geeks"]
# DataType Output: tuple
x = ("geeks", "for", "geeks")
# DataType Output: range
x = range(10)
# DataType Output: dict
x = {"name": "Suraj", "age": 24}
# DataType Output: set
x = {"geeks", "for", "geeks"}
# DataType Output: frozenset
x = frozenset({"geeks", "for", "geeks"})
# DataType Output: bool
x = True
# DataType Output: bytes
x = b"Geeks"
# DataType Output: bytearray
x = bytearray(4)
# DataType Output: memoryview
x = memoryview(bytes(6))
# DataType Output: NoneType
x = None
# Examples of Arithmetic Operator
a = 9
b = 4
# Addition of numbers
add = a + b
# Subtraction of numbers
sub = a - b
# Multiplication of number
mul = a * b
# Modulo of both number
mod = a % b
# Power
p = a ** b
# print results
print(add)
print(sub)
print(mul)
print(mod)
print(p)
# Examples of Bitwise operators
a = 10
b = 4
# Print bitwise AND operation
print(a & b)
# Print bitwise OR operation
print(a | b)
# Print bitwise NOT operation
print(~a)
# print bitwise XOR operation
print(a ^ b)
# print bitwise right shift operation
print(a >> 2)
# print bitwise left shift operation
print(a << 2)