aboutsummaryrefslogtreecommitdiff
path: root/src/Lecture4/live/live4.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/Lecture4/live/live4.py')
-rw-r--r--src/Lecture4/live/live4.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/Lecture4/live/live4.py b/src/Lecture4/live/live4.py
new file mode 100644
index 0000000..b011675
--- /dev/null
+++ b/src/Lecture4/live/live4.py
@@ -0,0 +1,39 @@
1
2def fun(a, b):
3 print("This is function fun")
4 print("I am executing!")
5 print("Your parameter a:", a)
6 z = a + b
7 if z > 10:
8 print("Your sum is large!", z)
9 while z > 5:
10 print("Decreasing sum:", z-1)
11 z = z - 1
12
13#fun(2, 11)
14#print("..")
15#fun(0, 7)
16
17def g(x, y):
18 #print("This is function g")
19 return (x**2 +1)*y
20
21print(g(10,2)-100)
22
23
24def fibo(n):
25 if n == 0:
26 return 0
27 if n == 1:
28 return 1
29 return fibo(n-1) + fibo(n-2)
30
31
32
33print(fibo(5))
34F = [fibo(x) for x in range(6)]
35print(F)
36
37
38
39

Generated with cgit - Back to sebastiano.tronto.net