当前位置:网站首页>python学习 day1——基础学习
python学习 day1——基础学习
2020-11-08 08:04:00 【osc_1mofhvr6】
1.python
python是一门解释型语言,也是弱类型编程语言。
2.变量
变量是一个用来存储数据的名字,可以在程序执行的过程中被多次调用。
2.1 变量的命名规则
1.有字母、数字、下划线组成
2.不能以数字开头,也不能是纯数字
3.不能是关键字
4.区分大小写
注意
1.变量命名不要太长
2.变量名要有意义
3.变量名不要是中文
4.可以采取驼峰式和下划线式命名
驼峰式命名:ageSexFamel,除首字母单词外其他单词的首字母均大写
下划线命名:age_sex_famel
3.数据类型
int (整数类型),可以进行操作运算,+, -, * ,/ ,%(取余) ,//(取整)
str (字符串类型),可以进行拼接和重复,+ (字符串拼接)*(字符串重复),使用单引号,双引号,三引号引起来的都是字符串
bool(布尔值),只有True和False两个值
4.条件语句 if else
- 仅有if条件语句
if 条件:
代码块
执行流程为:当条件成立,执行代码块
2.if && else
if 条件:
代码块1
else:
代码块2
执行流程,当条件成立,执行代码块1,否则执行代码块2,两个里面执行1个。
3.if && elif && else
if 条件1:
代码块1
elif 条件2:
代码块2
…
else:
代码块n
执行流程:如果满足条件1,就执行代码块1,如果满足条件2,就执行代码块2,如果所有条件都不满足,则执行else后面的代码块,从上往下,依次执行,如果有符合的条件,程序停止。
版权声明
本文为[osc_1mofhvr6]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4356644/blog/4707850
边栏推荐
- 面部识别:攻击类型和反欺骗技术
- Simple use of future in Scala
- Astra: Apache Cassandra的未来是云原生
- Is blazor ready to serve the enterprise?
- Do you really understand the high concurrency?
- Improvement of rate limit for laravel8 update
- 分布式共识机制
- Unparseable date: 'mon Aug 15 11:24:39 CST 2016', time format conversion exception
- [original] about the abnormal situation of high version poi autosizecolumn method
- On the stock trading of leetcode
猜你喜欢
5G+AR出圈,中国移动咪咕成第33届中国电影金鸡奖全程战略合作伙伴
C expression tree (1)
分布式共识机制
Face recognition: attack types and anti spoofing techniques
Qt混合Python开发技术:Python介绍、混合过程和Demo
Got timeout reading communication packets解决方法
Distributed consensus mechanism
Application of bidirectional LSTM in outlier detection of time series
什么你的电脑太渣?这几招包你搞定! (Win10优化教程)
2020-11-07:已知一个正整数数组,两个数相加等于N并且一定存在,如何找到两个数相乘最小的两个数?
随机推荐
Android Basics - RadioButton (radio button)
C++基础知识篇:C++ 基本语法
Simple use of future in Scala
Everything is 2020, LINQ query you are still using expression tree
use Xunit.DependencyInjection Transformation test project
C/C++编程笔记:C语言相比其他编程语言,有什么不一样的优势?
Delphi10's rest.json And system.json Step on the pit
微信昵称emoji表情,特殊表情导致列表不显示,导出EXCEL报错等问题解决!
Astra: the future of Apache Cassandra is cloud native
CPP (4) boost installation and basic use for Mac
【原创】关于高版本poi autoSizeColumn方法异常的情况
Experience the latest version of erofs on Ubuntu
Goland 编写含有template的程序
模板链表类学习
Ulab 1.0.0 release
高并发,你真的理解透彻了吗?
QT hybrid Python development technology: Python introduction, hybrid process and demo
Android 9.0/P WebView 多进程使用的问题
1.深入Istio:Sidecar自动注入如何实现的?
Data structure and sorting algorithm