Python 條件式 Condition
2024-09-01 22:48:44
除了重複使用Function,有時我們須檢查結果,依此判斷下個步驟該怎麼進行,如此就需要條件式 condition statement。
if ... elif ... ese ( 或 if ... elif ...elif 或 if .. else )
while
>>> def numIsEven(k):
... if k % 2 == 0:
... print(k,' is even')
... else:
... print(k,' is odd')
...
>>> numIsEven(8)
8 is even
>>> numIsEven(7)
7 is odd
/end
最新文章
- docker设置并运行部分命令及原文
- ELF Format 笔记(二)—— ELF Header
- 全零网络IP地址0.0.0.0表示意义详谈
- HelloWorld IL代码
- find命令下的atime,ctime,mtime
- codeforces 434B B. Nanami's Digital Board(分治)
- Excel连接字符串(Oledb)
- C#中启动外部应用程序
- MCS-51单片机I/O端口的存取
- OD调试篇3-小软件破解1
- 14.3.5.1 An InnoDB Deadlock Example
- dtree实现上下级关系的显示
- express学习点滴- 永远不要忘记异步
- Java基础之引用(String,char[],Integer)总结
- 使用pypi-server搭建简单的PyPI源
- CentOS在线安装RabbitMQ3.7
- Exp3 免杀原理与实践
- jquery打印页面(jquery.jqprint)
- [UI] UI things
- nvm(Node Version Manager)管理node版本
热门文章
- Sunset: Nightfall Vulnhub Walkthrough
- deinit 没执行
- Redis中几个简单的概念:缓存穿透/击穿/雪崩,别再被吓唬了
- springboot 读取 resource 下的文件
- WinCC的电子签名与审计追踪
- ReactNative: 使用弹出框组件ActionSheetIOS组件
- ReactNative: 使用对话框组件AlertIOS组件
- java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.解决方案
- 老版本nginx存在安全漏洞,不停服务热升级
- drf请求模块分析