-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconditionals_and_booleans.py
More file actions
executable file
·67 lines (56 loc) · 1.33 KB
/
conditionals_and_booleans.py
File metadata and controls
executable file
·67 lines (56 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#-------------------------------------------------
# About the conditionals and boolean statement
#----------------------------------------------
if True:
print('codition was true')
if False:
print('condition was false')
#comparisons Statement in Py
#Equal : ==
#Not equal : !=
#greater than : >, Less than: <
#Greater or equal: >= and Less or equal <=
#Object Identity: is
#and , or , not
language='java'
if language=='python':
print('conditional was true')
elif language =='java':
print("lang is java")
#We can add multiple elif in place of the switch terminlogy
else:
print('Not Match')
user='Admin'
logged_in= True
if user=='Admin' and logged_in:
#if user=='Admin' or loggrd_in:
#if not logged_in:
#print('Please log in')
print('admin page')
else:
print('bad credentiels')
#print('welcome')
a=[1,2,3,4,5]
b= [1,2,3,4,5]
c=[1,3,4]
d=[1,3,4]
print(a==b)
print(a is b) #print the false
print(id(a))
print(id(b))
print(c is d)
#Condtion that evalutes False by the statment
#False Values:
#1. False
#None
#Zero of any Numeric type
#Any emmpty sequence ex. '' , () , {}
# Any empty mapping , for example, {}
# Everything else will be evaluated to the true
condition=None
#condition ={}
#condtion =0
if condition:
print("it is evaluating true")
else:
print('evaluated to False')