-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01_variable.py
More file actions
82 lines (56 loc) · 1.14 KB
/
Copy path01_variable.py
File metadata and controls
82 lines (56 loc) · 1.14 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
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
# variables
a=1
b=2
c=7
name="Harry"
print(a+b)
print(name)
# datatypes
a=10 # a is a integer
b =10.99 # b is a floating point number
c="Harry" # c is a string
d=True # d is a boolean variable
e=None # e is a none type variable
# rules
a=10
b=100
sameer=10
same_er=20
_sameer=60
# @sameer=10 #Invalid due to @ symbol
# s@meer #Invalid dur to @ symbol
# Operators in Python
# Arithmetic operators
a = 7
b = 4
c = a+b
print(c)
# Assigment Operators
a=4-2 # Assign 4-2 in a
b=6
b+=3 #Increment in the value b by 3 and then assign it to b
c=8
c-=4 #Decrement in the value of c by 4 and then assign it to c
print(a)
print(b)
print(c)
# Comparison Operators
d=5>4
print(d)
e=5!=5
print(e)
f=5==6
print(f)
#Logical Operators
g = True or False
# Truth Table of or
print("True or False is ",True or False)
print("True or True is ",True or True)
print("False or True is ",False or True)
print("False or False is ",False or False)
# Truth Table of 'and'
print("True and False is ",True and False)
print("True and True is ",True and True)
print("False and True is ",False and True)
print("False and False is ",False and False)
print(not(False))