当前位置:网站首页>[song] rebirth of me in py introductory training (8): module
[song] rebirth of me in py introductory training (8): module
2022-07-27 06:05:00 【Collapse an old face】
It's not easy to create , Before reference , Point a praise , Collection , You can't pay too much attention , Family
The first 1 Turn off : Definition of modules
Task description
stay Python During the development of the program , For the convenience of code maintenance , We can group functions , Put them in different ones .py In the document , such , Each file contains relatively little code , This .py File is called a module (Module).
The goal of this chapter is to let readers understand and master Python Knowledge about module definition .
----------------------------------------------------------------------------------
Programming requirements
The programming task of this pass is to complete src/step1/module.py File code , Realize corresponding functions . The specific requirements are as follows :
- Enter the side lengths of the two right angles of the right triangle
aandb, It is required to calculate the bevel length ; - Required
mathmodular , And output the calculation result , The result retains three decimal places after the decimal point .
# Please add code here , Enter the side lengths of the two right angles of the right triangle a and b, Calculate the bevel length
#********** Begin *********#
j=math.sqrt(a**2+b**2)
print("%.3f"%j)
#********** End **********#The first 2 Turn off : Built in functions in built-in modules
Task description
We are installing Python After profile , Will also be Python The library with itself is also installed ,Python Its own library is also called Python The built-in modules .Python The built-in module of is Python An important organizational form of programming , The built-in functions in the built-in module also greatly facilitate the use of functions and other functions in the programming process .
The goal of this chapter is to let readers understand and master Python Knowledge of built-in modules and functions
---------------------------------------------------------------------------------、
Programming requirements
The programming task of this pass is to complete src/step2/built-module.py File code , Realize corresponding functions . The specific requirements are as follows :
- Enter two positive integers
a,b. It is required to judge whether there are two integers , Their sum isa, Product asb; - If there is , The output
Yes, If it does not exist , The outputNo.# Please add code here , It is required to judge whether there are two integers , Their sum is a, Product as b #********** Begin *********# y=0; for i in range(a): if(i*(a-i)==b): print("Yes") y=1; break if(y==0): print("No") #********** End **********#notes : The content is only for reference and sharing , Do not spread without permission , Tort made delete
边栏推荐
- A photo breaks through the face recognition system: you can nod your head and open your mouth, netizens
- 【头歌】重生之我在py入门实训中(2):公式编程
- Xmind 思维导图 2022 v12.0.3中文版更新了哪些内容?
- Cesium教程 (1) 界面介绍-3dtiles加载-更改鼠标操作设置
- 西瓜书学习第五章---神经网络
- Weidongshan digital photo frame project learning (II) displaying Chinese characters on LCD
- 发布 分辨率0.22m的建筑物分割数据库
- 制作视频后期特效需要什么工具?
- 关于druid连接不上数据库的问题
- 16. Over fitting and under fitting
猜你喜欢

Can it replace PS's drawing software?

9. High order operation
![[high concurrency] interviewer](/img/50/baa662cb4ce30cf2ef4cb5952960dd.jpg)
[high concurrency] interviewer
![[MySQL learning] 8](/img/25/84d5acbdd8aba3455ab8e3eb17dfa8.png)
[MySQL learning] 8

QGIS系列(1)-QGIS(server-apache) win10安装

Day 3. Suicidal ideation and behavior in institutions of higher learning: A latent class analysis

方差与协方差

【Arduino】重生之Arduino 学僧(1)

发布 分辨率0.22m的建筑物分割数据库

When multiple formulas in latex share a sequence number
随机推荐
LaTeX中多个公式公用一个序号时
11. Gradient derivation of perceptron
韦东山 数码相框 项目学习(三)freetype的移植
Dpdk network protocol stack VPP OVS DDoS Sdn nfv virtualization high performance expert Road
【12】理解电路:从电报机到门电路,我们如何做到“千里传信”?
Chrome 如何快速将一组正在浏览的网页(tabs)转移到另一台设备(电脑)上
文件的路径
[first song] rebirth of me in py introductory training (4): Circular program
编程学习记录——第8课【数组与设计五子棋,扫雷游戏】
STM32-FSMC外扩内存SRAM
leetcode系列(一):买卖股票
[high concurrency] interviewer
Live Home 3D Pro室内家居设计工具
A photo breaks through the face recognition system: you can nod your head and open your mouth, netizens
Pix2Pix原理解析
李宏毅 2020 深度学习与人类语言处理 DLHLP-Conditional Generation by RNN and Attention-p22
韦东山 数码相框 项目学习(二)在LCD上显示中文字符
AE 3D particle system plug-in: Trapcode particle
[MVC Architecture] MVC model
arcgis style样式表文件转换成geoserver sld文件