当前位置:网站首页>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
边栏推荐
- 分布式共识机制
- Astra: Apache Cassandra的未来是云原生
- Problems of Android 9.0/p WebView multi process usage
- FORTRAN77从文件中读入若干数据并用heron迭代公式开方
- 2020-11-07:已知一个正整数数组,两个数相加等于N并且一定存在,如何找到两个数相乘最小的两个数?
- 来自不同行业领域的50多个对象检测数据集
- Codeforce算法题 | 你能想出解法,让你的基友少氪金吗?
- C / C + + Programming Notes: what are the advantages of C compared with other programming languages?
- Download, installation and configuration of Sogou input method in Ubuntu
- China Telecom announces 5g SA commercial scale in 2020
猜你喜欢
Astra: Apache Cassandra的未来是云原生
什么你的电脑太渣?这几招包你搞定! (Win10优化教程)
ulab 1.0.0发布
C/C++编程笔记:C语言相比其他编程语言,有什么不一样的优势?
A compilation bug brought by vs2015 Update1 update [existing solutions]
Ulab 1.0.0 release
OSChina 周日乱弹 —— 之前呢,我一直以为自己是个……
VC6 compatibility and open file crash resolution
Is blazor ready to serve the enterprise?
Do you really understand the high concurrency?
随机推荐
Blazor 准备好为企业服务了吗?
On the stock trading of leetcode
Golang anonymous structure member, named structure member, inheritance, composition
解决RabbitMQ消息丢失与重复消费问题
The most detailed usage guide for perconaxtradbcluster8.0
Ulab 1.0.0 release
Introduction to ucgui
Solve the problem of rabbitmq message loss and repeated consumption
SQL Server 2008R2 18456 error resolution
Visual studio 2015 unresponsive / stopped working problem resolution
QT hybrid Python development technology: Python introduction, hybrid process and demo
Swiper window width changes, page width height changes lead to automatic sliding solution
VC6 compatibility and open file crash resolution
Data structure and sorting algorithm
Qt混合Python开发技术:Python介绍、混合过程和Demo
What details does C + + improve on the basis of C
微信昵称emoji表情,特殊表情导致列表不显示,导出EXCEL报错等问题解决!
Insight -- the application of sanet in arbitrary style transfer
在Ubuntu上体验最新版本EROFS
Application of bidirectional LSTM in outlier detection of time series