-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
173407f
commit 7bcaad8
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |