当前位置:网站首页>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))
边栏推荐
- 函数传递参数小案例
- RHCAS6
- Shi Zhenzhen's 2021 summary and 2022 outlook | colorful eggs at the end of the article
- Run, open circuit
- Comprehensive upgrade of Taobao short video photosynthetic platform
- Introduction aux contrôles de la page dynamique SAP ui5
- 谈谈我写作生涯的画图技巧
- Didi open source Delta: AI developers can easily train natural language models
- #yyds干货盘点# 解决名企真题:搬圆桌
- 使用 jMeter 对 SAP Spartacus 进行并发性能测试
猜你喜欢

RHCSA1

Taobao flag insertion remarks | logistics delivery interface

Simply take stock reading notes (4/8)
![[cloud native] event publishing and subscription in Nacos -- observer mode](/img/0f/34ab42b7fb0085f58f36eb67b6f107.png)
[cloud native] event publishing and subscription in Nacos -- observer mode

Oppo Xiaobu launched Obert, a large pre training model, and promoted to the top of kgclue

Distance measuring sensor chip 4530a used in home intelligent lighting

Transactions on December 23, 2021

leetcode:221. 最大正方形【dp状态转移的精髓】

实战模拟│JWT 登录认证

Shi Zhenzhen's 2021 summary and 2022 outlook | colorful eggs at the end of the article
随机推荐
2021-12-22 transaction record
A few years ago, I outsourced for four years. Qiu Zhao felt that life was like this
Super efficient! The secret of swagger Yapi
Halcon 模板匹配实战代码(一)
946. 验证栈序列
HiEngine:可媲美本地的云原生内存数据库引擎
Neural network of PRML reading notes (1)
Insmod prompt invalid module format
Association modeling method in SAP segw transaction code
Transactions from December 27 to 28, 2021
RHCSA1
使用 jMeter 对 SAP Spartacus 进行并发性能测试
解决 UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa2 in position 107
你的下一台电脑何必是电脑,探索不一样的远程操作
What if wechat is mistakenly sealed? Explain the underlying logic of wechat seal in detail
自然语言处理从小白到精通(四):用机器学习做中文邮件内容分类
RHCAS6
NFT: how to make money with unique assets?
Hiengine: comparable to the local cloud native memory database engine
实现 1~number 之间,所有数字的加和

