-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercise.py
45 lines (38 loc) · 999 Bytes
/
exercise.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
##########################################################################
## Modify the variables so that all of the statements evaluate to True. ##
##########################################################################
var1 = 1
var6 = 1.1
var2 = "pomennext"
var3 = [1,2,3,4,5]
var4 = (1,2,"Hello, Python!")
var5 = {
"happy":7,
"tuna":"fish",
"egg":"salad"
}
############################################
## Don't edit anything below this comment ##
############################################
# integers
print(type(var1) is int)
print(type(var6) is float)
print(var1 < 35)
print(var1 <= var6)
# strings
print(type(var2) is str)
print(var2[5] == 'n' and var2[0] == "p")
# lists
print(type(var3) is list)
print(len(var3) == 5)
# tuples
print(type(var4) is tuple)
print(var4[2] == "Hello, Python!")
# dictionaries
print(type(var5) is dict)
print("happy" in var5)
print(7 in var5.values())
print(var5.get("egg") == "salad")
print(len(var5) == 3)
var5["tuna"] = "fish"
print(len(var5) == 3)