当前位置:网站首页>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
边栏推荐
- Face recognition: attack types and anti spoofing techniques
- Wechat nickname Emoji expression, special expression causes the list not to be displayed, export excel error report and other problems solved!
- Download, installation and configuration of Sogou input method in Ubuntu
- Delphi10's rest.json And system.json Step on the pit
- leetcode之判断路径是否相交
- scala 中 Future 的简单使用
- 到底选openstack还是vmware?
- Lay UI left tree Dtree right list table
- 鼠标变小手
- 归纳一些比较好用的函数
猜你喜欢
Is blazor ready to serve the enterprise?
UCGUI简介
Lay UI left tree Dtree right list table
leetcode之判断路径是否相交
wanxin金融
About the promotion of the whole stack of engineers, from the introduction to give up the secret arts, do not click in to have a look?
Wechat applet request reported 400 error @ requestbody failed to receive
Improvement of rate limit for laravel8 update
C/C++编程笔记:C语言相比其他编程语言,有什么不一样的优势?
Basic knowledge of C + +
随机推荐
在Ubuntu上体验最新版本EROFS
Template linked list learning
C language I blog assignment 03
Tail delivery
iOS上传App Store报错:this action cannot be completed -22421 解决方案
Qt混合Python开发技术:Python介绍、混合过程和Demo
Six key points of data science interview
Using subprocess residue in supervisor and python multiprocessing
PCR and PTS calculation and inverse operation in TS stream
技术人员该如何接手一个复杂的系统?
laravel8更新之速率限制改进
Windows subsystem Ubuntu installation
Face recognition: attack types and anti spoofing techniques
Swiper window width changes, page width height changes lead to automatic sliding solution
Lay UI left tree Dtree right list table
ulab 1.0.0发布
Ulab 1.0.0 release
Speed up your website with jsdelivr
Face recognition: attack types and anti spoofing techniques
C expression tree (1)