repl.it
@hufeigopython/

basic_python_homework13

Python

製作一個模組

fork
loading
Files
  • main.py
  • __init__.py
  • number_module.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
# 引入模組
from number_module import sum
from number_module import subtract

number1 = int(input("數字1:"))
number2 = int(input("數字2:"))

def main():
    result_1 = sum(number1, number2)
    result_2 = subtract(number1, number2)
    print(result_1)
    print(result_2)
main()