mathsoftware

A course about LaTeX and SageMath
git clone https://git.tronto.net/mathsoftware
Download | Log | Files | Refs | README | LICENSE

live4.py (494B)


      1 
      2 def 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 
     17 def g(x, y):
     18 	#print("This is function g")
     19 	return (x**2 +1)*y
     20 	
     21 print(g(10,2)-100)
     22 
     23 
     24 def 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 
     33 print(fibo(5))
     34 F = [fibo(x) for x in range(6)]
     35 print(F)
     36 
     37 
     38 
     39