def math(): input1 = float(input("Enter a whole number: ")) opp = input("Enter the operation you would like to use: ") input2 = float(input("Enter another whole number: ")) if opp == "*": calc2.multiply(input1, input2) elif opp == "+": calc2.add(input1, input2) elif opp == "-": calc2.sub(input1, input2) elif opp == "/": calc2.divide(input1, input2) else: print("Invalid entry")
import calc2 print(calc2.add(2,3))
def test_Add(): value = calc2.add(NUMBER_1, NUMBER_2) assert value == 90
# 以主程序形式运行 import calc2 print(calc2.add(100, 200))
import sys paths = sys.path print(paths) sys.path.append("c:\\Python_modules") import calc2 c = calc2.add(4, 5) print(c)
# --*--coding:utf-8--*-- # author : hmchen # email : [email protected] # date : 2021/1/27 15:19 """ 自定义模块 """ # 导本地工程包设置:包反键-->Mark Directory as -->Source Root import calc2 print(calc2.add(1, 2))
import calc2 print(calc2.add(2, 4))
def fun1(): add() print("From Fun1")