eEcho blog

is een halte van de gedachte

Python Modules

Grotte programma's zou kunnen verdeeld worden in modules.
# numbers.py
def divide(a,b):
   q = a/b
   r = a - q*b
   return q,r

def gcd(x,y):
   g = y
   while x > 0:
      g = x
      x = y % x
      y = g
   return g

#run.py
import numbers
x,y = numbers.divide(42,5)
n = numbers.gcd(7291823, 5683)

Add A Comment

You must be logged in to post a comment.

Home | info@eecho.info | Voorwaarden | Blog