Created
January 26, 2011 19:29
-
-
Save erikkaplun/797257 to your computer and use it in GitHub Desktop.
Moodulite importimine
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
def hello(): | |
print('Hello!') | |
def say_greetings(name): | |
print('Greetings, %s!' % name) | |
# Python 3: | |
# print('Greetings, {0}!'.format(name)) |
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
import foo | |
foo.hello() | |
# ekraanile ilmub: Hello! | |
foo.say_greetings('Anton') | |
# ekraanile ilmub: Greetings, Anton! | |
foo.say_greetings('Erik') | |
foo.say_greetings('Juhan') | |
# alternatiiv-versioon: | |
# | |
# from foo import hello, say_greetings | |
# hello() | |
# say_greetings('Anton') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
foo.py
jamain.py
tuleb panna samasse kausta ning seejärel käivitada skriptmain.py
.