From 31ee062ad12adcf6dae6716cb566fcbcde9f6959 Mon Sep 17 00:00:00 2001 From: geno Date: Thu, 18 Jul 2024 12:16:40 +0200 Subject: codegen while implemented, test added --- test/2f.py | 4 ++-- test/2g-fibonacci.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 test/2g-fibonacci.py (limited to 'test') diff --git a/test/2f.py b/test/2f.py index d83457b..fa71493 100644 --- a/test/2f.py +++ b/test/2f.py @@ -3,8 +3,8 @@ n = 6 counter = 1 result = 1 -while n - 1 == counter: +while n - 1 != counter: result = result * counter - counter = counter - 1 + counter = counter + 1 print(result) diff --git a/test/2g-fibonacci.py b/test/2g-fibonacci.py new file mode 100644 index 0000000..fb1ac9f --- /dev/null +++ b/test/2g-fibonacci.py @@ -0,0 +1,13 @@ +n = 9 + +a = 0 +b = 1 +c = 0 +i = 0 +while i < n - 2: + c = a + b + a = b + b = c + i = i + 1 + +print(c) -- cgit v1.2.3-18-g5258