We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eaedcbd commit 2cc3f0bCopy full SHA for 2cc3f0b
2 files changed
python-built-in-functions/fibonacci.py
@@ -1,11 +1,11 @@
1
-class Fibonacci:
2
- def __init__(self):
3
- self._cache = [0, 1]
+class Fibonaccish:
+ def __init__(self, initial_value=1):
+ self._cache = [0, initial_value]
4
5
def __call__(self, index):
6
if index < len(self._cache):
7
fib_number = self._cache[index]
8
- print(f"{fib_number} id = {id(fib_number)}")
+ print(f"{index} {fib_number} id = {id(fib_number)}")
9
else:
10
fib_number = self(index - 1) + self(index - 2)
11
self._cache.append(fib_number)
python-built-in-functions/progress.py
@@ -1,7 +1,5 @@
def progress(percent=0, width=30):
- end = ""
- if percent == 100:
- end = "\n"
+ end = "" if percent < 100 else "\n"
left = width * percent // 100
right = width - left
print(
0 commit comments