-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconditions.py
More file actions
92 lines (50 loc) · 1.28 KB
/
conditions.py
File metadata and controls
92 lines (50 loc) · 1.28 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
83
84
85
86
87
88
89
90
91
92
# x = 2
# print(x == 2) # prints out True
# print(x == 3) # prints out False
# print(x < 3) # prints out True
# # condition using "and" "or" operators
# name = "John"
# age = 23
# if name == "John" and age == 23:
# print("Your name is John, and you are also 23 years old.")
# if name == "John" or name == "Rick":
# print("Your name is either John or Rick.")
# # in operators
# name = "John"
# if name in ["John", "Rick"]:
# print("Your name is either John or Rick.")
# # if else statement
# x = 2
# if x == 2:
# print("x equals two!")
# else:
# print("x does not equal to two.")
# # the is operator
# x = [1,2,3]
# y = [1,2,3]
# print(x == y) # Prints out True
# print(x is y) # Prints out False
# # not operator
# print(not False) # Prints out True
# print((not False) == (False)) # Prints out False
'''
EXERCISE
Change the variables in the first section, so that each if statement resolves as True.
'''
# change this code
number = 10
second_number = 10
first_array = []
second_array = [1,2,3]
if number > 15:
print("1")
if first_array:
print("2")
if len(second_array) == 2:
print("3")
if len(first_array) + len(second_array) == 5:
print("4")
if first_array and first_array[0] == 1:
print("5")
if not second_number:
print("6")