aboutsummaryrefslogtreecommitdiffstats
path: root/test1.py
diff options
context:
space:
mode:
authorzedarider <ymherklotz@gmail.com>2016-02-18 11:37:45 +0000
committerzedarider <ymherklotz@gmail.com>2016-02-18 11:37:45 +0000
commitaf98ee7ff28cff97f5f29a5d9e65f9153531b0ee (patch)
tree86bfc53a0bc04512ac2936ee067a2b43e901e688 /test1.py
downloadimperial_2015-af98ee7ff28cff97f5f29a5d9e65f9153531b0ee.tar.gz
imperial_2015-af98ee7ff28cff97f5f29a5d9e65f9153531b0ee.zip
Imperial C++ Directory
These are all the projects I’ve been working on at university.
Diffstat (limited to 'test1.py')
-rw-r--r--test1.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test1.py b/test1.py
new file mode 100644
index 0000000..db3f188
--- /dev/null
+++ b/test1.py
@@ -0,0 +1,16 @@
+def fib(*arg):
+ fib1 = [0, 1]
+ if(len(arg) == 1):
+ for x in range(2, arg[0]):
+ fib1.append(fib1[x-2]+fib1[x-1])
+ print(fib1)
+ elif(len(arg) == 2):
+ for x in range(2, arg[1]):
+ fib1.append(fib1[x-2]+fib1[x-1])
+ print(fib1[arg[0]-1:])
+
+def main():
+ fib(10, 20)
+
+if __name__ == '__main__':
+ main() \ No newline at end of file