Skip to content

Commit

Permalink
St 09.04.2014 09:31 -- moduly
Browse files Browse the repository at this point in the history
  • Loading branch information
MarrekNozka committed Apr 9, 2014
1 parent 173407f commit 7bcaad8
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
29 changes: 29 additions & 0 deletions myfnc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/python
# -*- coding: utf8 -*-
# Soubor: myfnc.py
# Datum: 09.04.2014 08:55
# Autor: Marek Nožka, nozka <@t> spseol <d.t> cz
# Licence: GNU/GPL
# Úloha: malý modul pro moje vlastní funkce
############################################################################
from __future__ import unicode_literals


def exp(x):
""" exp(x) -> vrátí hodnotu exponenciální funkce
e na x
"""
vysl = 1
citatel = float(x)
jmenovatel = 1.
n = 1
while citatel/jmenovatel > 1e-6:
vysl += citatel/jmenovatel
citatel *= x
n += 1
jmenovatel *= n
return vysl


def mocnina(x, y):
return x**y
18 changes: 18 additions & 0 deletions program.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/python
# -*- coding: utf8 -*-
# Soubor: program.py
# Datum: 09.04.2014 08:55
# Autor: Marek Nožka, nozka <@t> spseol <d.t> cz
# Licence: GNU/GPL
# Úloha: program ve kterém volám vlastní modul
############################################################################
from __future__ import unicode_literals

import myfnc


print myfnc.exp(1)
print myfnc.exp(2)
print myfnc.exp(3)

print myfnc.mocnina(2, 8)

0 comments on commit 7bcaad8

Please sign in to comment.