Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ef1fef2

Browse files
added idea behind __name__ == __main__
1 parent 442a568 commit ef1fef2

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
# see result by right click and run on both mymath.py and test.py and see difference
3+
4+
def add(a, b):
5+
return a+b
6+
7+
print(__name__)
8+
if __name__ == "__main__": # this is same as main method in c++ or other pro. lang.
9+
print(add(10,16))
102 KB
Loading[フレーム]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
import mymath
4+
5+
print(mymath.add(7,6))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /