当前位置:网站首页>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))
边栏推荐
- 潘多拉 IOT 开发板学习(HAL 库)—— 实验7 窗口看门狗实验(学习笔记)
- Transactions from January 6 to October 2022
- MySQL 巨坑:update 更新慎用影响行数做判断!!!
- 【云原生】Nacos中的事件发布与订阅--观察者模式
- A few years ago, I outsourced for four years. Qiu Zhao felt that life was like this
- Introduction to sap ui5 dynamicpage control
- 解决 UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa2 in position 107
- 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é.
- 我在滴滴做开源
- Taobao short video, why the worse the effect
猜你喜欢

Pinduoduo flag insertion remarks API

SAP UI5 ObjectPageLayout 控件使用方法分享

Setting up sqli lab environment

Install rhel8.2 virtual machine

Pandora IOT development board learning (HAL Library) - Experiment 7 window watchdog experiment (learning notes)

Association modeling method in SAP segw transaction code

使用 jMeter 对 SAP Spartacus 进行并发性能测试

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é.

Four common problems of e-commerce sellers' refund and cash return, with solutions

Laravel document reading notes -mews/captcha use (verification code function)
随机推荐
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é.
Pinduoduo flag insertion remarks API
无密码身份验证如何保障用户隐私安全?
Transactions on December 23, 2021
NFT: how to make money with unique assets?
RHCSA2
The solution of outputting 64 bits from printf format%lld of cross platform (32bit and 64bit)
函数传递参数小案例
Oppo Xiaobu launched Obert, a large pre training model, and promoted to the top of kgclue
Simply take stock reading notes (2/8)
SAP UI5 ObjectPageLayout 控件使用方法分享
国内市场上的BI软件,到底有啥区别
使用 jMeter 对 SAP Spartacus 进行并发性能测试
Research: data security tools cannot resist blackmail software in 60% of cases
【Nacos云原生】阅读源码第一步,本地启动Nacos
A specific example of ABAP type and EDM type mapping in SAP segw transaction code
Transactions from December 27 to 28, 2021
你的下一台电脑何必是电脑,探索不一样的远程操作
百日完成国产数据库opengausss的开源任务--openGuass极简版3.0.0安装教程
How do e-commerce sellers refund in batches?

