-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_dict_simple.roast
More file actions
44 lines (37 loc) · 909 Bytes
/
test_dict_simple.roast
File metadata and controls
44 lines (37 loc) · 909 Bytes
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
# Ultra simple dict test
d: dict[int, int] = {}
def main() -> int:
print("1. Setting values...")
d[1] = 100
d[2] = 200
d[3] = 300
print("2. Getting values...")
v1 = d[1]
print(f"d[1] = {v1}")
v2 = d[2]
print(f"d[2] = {v2}")
v3 = d[3]
print(f"d[3] = {v3}")
print("3. Comparing values...")
if v1 == 100:
print("v1 == 100: True")
if v2 == 100:
print("v2 == 100: True")
else:
print("v2 == 100: False")
if v3 == 100:
print("v3 == 100: True")
else:
print("v3 == 100: False")
print("4. Range iteration...")
for i in range(1, 4):
print(f" i = {i}")
val = d[i]
print(f" d[{i}] = {val}")
if val == 100:
print(f" val == 100: True")
else:
print(f" val == 100: False")
print("5. Done!")
return 0
main()