d
This commit is contained in:
2
gen-Python
Executable file
2
gen-Python
Executable file
@@ -0,0 +1,2 @@
|
||||
echo "python3 main.py" > test_memory_Python
|
||||
chmod +x test_memory_Python
|
||||
38
main.py
Normal file
38
main.py
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
|
||||
# L4: Function.
|
||||
|
||||
def memory_generateConstPlayfield(
|
||||
n: int
|
||||
) -> dict[int, int]:
|
||||
idGroups: dict[int, int] = { }
|
||||
id = 0
|
||||
for gid in range(0, n):
|
||||
idGroups[id] = gid
|
||||
id += 1
|
||||
idGroups[id] = gid
|
||||
id += 1
|
||||
#}
|
||||
return idGroups
|
||||
#}
|
||||
|
||||
# L20: Test.
|
||||
|
||||
def test_memory_generateConstPlayfield() -> str:
|
||||
idGroups = memory_generateConstPlayfield(2)
|
||||
if (
|
||||
len(idGroups) == 4 and
|
||||
idGroups[0] == 0 and
|
||||
idGroups[1] == 0 and
|
||||
idGroups[2] == 1 and
|
||||
idGroups[3] == 1
|
||||
):
|
||||
return "OK: memory_generateConstPlayfield"
|
||||
#}
|
||||
return "ERR: memory_generateConstPlayfield"
|
||||
#}
|
||||
|
||||
# L36: Run.
|
||||
|
||||
print(test_memory_generateConstPlayfield())
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
|
||||
// L4: Function
|
||||
// L4: Function.
|
||||
|
||||
func memory_generateConstPlayfield(
|
||||
_ n: Int
|
||||
|
||||
Reference in New Issue
Block a user