当前位置:网站首页>Put functions in modules
Put functions in modules
2022-07-05 13:01:00 【South Lake Fishing Song】
# ------------- compute.py ---------------------------
def add(x,y):
return x + y
def sub(x,y):
return x - y
def mul(x,y):
return x * y
def div(x,y):
return x / y
# ------------- main.py ---------------------------
import compute as cp
print(cp.add(3,5))
print(cp.sub(3,5))
print(cp.mul(3,5))
print(cp.div(3,5))
from compute import add,sub,mul,div
print(add(3,5))
print(sub(3,5))
print(mul(3,5))
print(div(3,5))
from compute import * # Not recommended
print(add(3,5))
print(sub(3,5))
print(mul(3,5))
print(div(3,5))
边栏推荐
- A small talk caused by the increase of sweeping
- ABAP editor in SAP segw transaction code
- Rasa Chat Robot Tutorial (translation) (1)
- 太方便了,钉钉上就可完成代码发布审批啦!
- It's too convenient. You can complete the code release and approval by nailing it!
- Transactions on December 23, 2021
- SAP SEGW 事物码里的 ABAP Editor
- RHCSA5
- Laravel document reading notes -mews/captcha use (verification code function)
- Wechat enterprise payment to change access, open quickly
猜你喜欢
It's too convenient. You can complete the code release and approval by nailing it!
Didi open source Delta: AI developers can easily train natural language models
Lepton 无损压缩原理及性能分析
Pandora IOT development board learning (HAL Library) - Experiment 7 window watchdog experiment (learning notes)
Oppo Xiaobu launched Obert, a large pre training model, and promoted to the top of kgclue
简单上手的页面请求和解析案例
开发者,云原生数据库是未来吗?
使用 jMeter 对 SAP Spartacus 进行并发性能测试
SAP UI5 DynamicPage 控件介紹
A deep long article on the simplification and acceleration of join operation
随机推荐
Taobao, pinduoduo, jd.com, Doudian order & Flag insertion remarks API solution
Laravel document reading notes -mews/captcha use (verification code function)
Transactions on December 23, 2021
jxl笔记
Natural language processing from Xiaobai to proficient (4): using machine learning to classify Chinese email content
About the single step debugging of whether SAP ui5 floating footer is displayed or not and the benefits of using SAP ui5
阿里云SLB负载均衡产品基本概念与购买流程
leetcode:221. 最大正方形【dp状态转移的精髓】
How do e-commerce sellers refund in batches?
国内市场上的BI软件,到底有啥区别
解决 UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa2 in position 107
A possible investment strategy and a possible fuzzy fast stock valuation method
Why is your next computer a computer? Explore different remote operations
SAP ui5 objectpagelayout control usage sharing
NLP engineer learning summary and index
Compilation principle reading notes (1/12)
Discussion on error messages and API versions of SAP ui5 getsaplogonlanguage is not a function
SAP UI5 DynamicPage 控件介紹
Talk about my drawing skills in my writing career
Halcon 模板匹配实战代码(一)