当前位置:网站首页>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))
边栏推荐
- NLP engineer learning summary and index
- 《信息系统项目管理师》备考笔记---信息化知识
- 10 minute fitness method reading notes (5/5)
- Natural language processing series (I) introduction overview
- stirring! 2022 open atom global open source summit registration is hot!
- SAP SEGW 事物码里的 Association 建模方式
- Taobao short videos are automatically released in batches without manual RPA open source
- How to connect the API interface of Taobao open platform (super detailed)
- 跨平台(32bit和64bit)的 printf 格式符 %lld 输出64位的解决方式
- 超高效!Swagger-Yapi的秘密
猜你喜欢

RHCSA3

SAP SEGW 事物码里的 Association 建模方式

百日完成国产数据库opengausss的开源任务--openGuass极简版3.0.0安装教程

谈谈我写作生涯的画图技巧

Taobao, pinduoduo, jd.com, Doudian order & Flag insertion remarks API solution

SAP UI5 DynamicPage 控件介紹

Taobao order interface | order flag remarks, may be the most stable and easy-to-use interface

RHCSA5

Install rhel8.2 virtual machine

Introduction to sap ui5 flexiblecolumnlayout control
随机推荐
Laravel document reading notes -mews/captcha use (verification code function)
A few years ago, I outsourced for four years. Qiu Zhao felt that life was like this
Introduction to the principle of DNS
Hiengine: comparable to the local cloud native memory database engine
关于 SAP UI5 getSAPLogonLanguage is not a function 的错误消息以及 API 版本的讨论
Wechat enterprise payment to change access, open quickly
Kotlin process control and circulation
MySQL giant pit: update updates should be judged with caution by affecting the number of rows!!!
SAP UI5 ObjectPageLayout 控件使用方法分享
NFT: how to make money with unique assets?
insmod 提示 Invalid module format
Install rhel8.2 virtual machine
以VMware创新之道,重塑多云产品力
946. 验证栈序列
How can non-technical departments participate in Devops?
超高效!Swagger-Yapi的秘密
《2022年中國銀行業RPA供應商實力矩陣分析》研究報告正式啟動
自然语言处理系列(一)入门概述
Pandora IOT development board learning (HAL Library) - Experiment 7 window watchdog experiment (learning notes)
JXL notes

