当前位置:网站首页>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))
边栏推荐
- 155. 最小栈
- 实现 1~number 之间,所有数字的加和
- 由扫地增而引起的小叙
- SAP SEGW 事物码里的 ABAP Editor
- Concurrent performance test of SAP Spartacus with JMeter
- Le rapport de recherche sur l'analyse matricielle de la Force des fournisseurs de RPA dans le secteur bancaire chinois en 2022 a été officiellement lancé.
- MySQL giant pit: update updates should be judged with caution by affecting the number of rows!!!
- 百日完成国产数据库opengausss的开源任务--openGuass极简版3.0.0安装教程
- Introduction aux contrôles de la page dynamique SAP ui5
- Taobao product details API | get baby SKU, main map, evaluation and other API interfaces
猜你喜欢
Taobao order amount check error, avoid capital loss API
Super efficient! The secret of swagger Yapi
滴滴开源DELTA:AI开发者可轻松训练自然语言模型
RHCAS6
SAP UI5 DynamicPage 控件介绍
DNS的原理介绍
Simply take stock reading notes (3/8)
《信息系统项目管理师》备考笔记---信息化知识
SAP SEGW 事物码里的导航属性(Navigation Property) 和 EntitySet 使用方法
Transactions from December 27 to 28, 2021
随机推荐
你的下一台电脑何必是电脑,探索不一样的远程操作
CVPR 2022 | single step 3D target recognizer based on sparse transformer
Rasa Chat Robot Tutorial (translation) (1)
leetcode:221. 最大正方形【dp状态转移的精髓】
Lepton 无损压缩原理及性能分析
Comprehensive upgrade of Taobao short video photosynthetic platform
Insmod prompt invalid module format
谈谈我写作生涯的画图技巧
SAP UI5 DynamicPage 控件介紹
Reshape the power of multi cloud products with VMware innovation
I met Tencent in the morning and took out 38K, which showed me the basic smallpox
MySQL splits strings for conditional queries
Halcon 模板匹配实战代码(一)
Four common problems of e-commerce sellers' refund and cash return, with solutions
SAP SEGW 事物码里的 ABAP 类型和 EDM 类型映射的一个具体例子
奔跑,开路
#yyds干货盘点#js截取文件后缀名
关于 SAP UI5 getSAPLogonLanguage is not a function 的错误消息以及 API 版本的讨论
##无监控,不运维,以下是监控里常用的脚本监控
It's too convenient. You can complete the code release and approval by nailing it!