-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay4.py
97 lines (75 loc) · 1.55 KB
/
Day4.py
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
91
92
93
94
95
96
97
# Conditionals and If,Else, & elif statements
#If-Else
language = 'Java'
if language == 'Python' :
print('Language is Python')
else:
print('Language is Java')
# elif
language = 'Go'
if language == 'Java':
print("Language is Java")
elif language == 'Go':
print("Language is Go")
else:
print("Language Not Found")
# Python doesn't have a switchcase
# Booleans
# and or not
user = 'Admin'
logged_in = False
if user == 'Admin' and logged_in:
print('Admin Page')
else:
print('Bad Creds')
if user == 'Admin' or logged_in:
print('Admin Page')
else:
print('Bad Creds')
if not logged_in:
print('Please log in')
else:
print('Welcome')
# is comparisons
# here "is" doing comparisons between ids of comparators
a = [1, 2, 3]
b = [1, 2, 3]
if a is b:
print('Equal')
else:
print(id(a))
print(id(b))
print('Not Equal')
# All FALSE value evaluated in python
# False, None, Zero (0), Any empty sequence example (), [], ''
# any empty mappin example {}
condition = False
if condition:
print("Evaluated to TRUE")
else:
print("Evaluated to False")
condition = None
if condition:
print('True')
else:
print('False')
condition = 0
if condition:
print('True')
else:
print('False')
condition = 10
if condition:
print('True')
else:
print('False')
# condition = '' / [] /()
if condition:
print('True')
else:
print('False')
condition = {}
if condition:
print('True')
else:
print('False')