当前位置:网站首页>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
边栏推荐
- What details does C + + improve on the basis of C
- 面部识别:攻击类型和反欺骗技术
- Distributed consensus mechanism
- Is blazor ready to serve the enterprise?
- Do you really understand the high concurrency?
- Qt混合Python开发技术:Python介绍、混合过程和Demo
- Improvement of rate limit for laravel8 update
- 学习Scala IF…ELSE 语句
- Adobe Prelude /Pl 2020软件安装包(附安装教程)
- 5g + Ar out of the circle, China Mobile Migu becomes the whole process strategic partner of the 33rd China Film Golden Rooster Award
猜你喜欢

来自不同行业领域的50多个对象检测数据集

面部识别:攻击类型和反欺骗技术

scala 中 Future 的简单使用

Basic operation of database

VC6兼容性及打开文件崩溃问题解决

Swiper window width changes, page width height changes lead to automatic sliding solution

Visual studio 2015 unresponsive / stopped working problem resolution
![A compilation bug brought by vs2015 Update1 update [existing solutions]](/img/3b/00bc81122d330c9d59909994e61027.jpg)
A compilation bug brought by vs2015 Update1 update [existing solutions]

What? Your computer is too bad? You can handle these moves! (win10 optimization tutorial)

ts流中的pcr与pts计算与逆运算
随机推荐
Judging whether paths intersect or not by leetcode
Get tree menu list
Qt混合Python开发技术:Python介绍、混合过程和Demo
Is blazor ready to serve the enterprise?
iOS 学习笔记二【cocopods安装使用和安装过程中遇到的问题及解决办法】【20160725更新】
异常+abstract
laravel8更新之速率限制改进
Tail delivery
More than 50 object detection datasets from different industries
Android 9.0/P WebView 多进程使用的问题
Blazor 准备好为企业服务了吗?
Mouse small hand
面部识别:攻击类型和反欺骗技术
QT hybrid Python development technology: Python introduction, hybrid process and demo
Codeforce算法题 | 你能想出解法,让你的基友少氪金吗?
接口
什么你的电脑太渣?这几招包你搞定! (Win10优化教程)
golang 匿名结构体成员,具名结构体成员,继承,组合
搜索引擎的日常挑战_4_外部异构资源 - 知乎
麦格理银行借助DataStax Enterprise (DSE) 驱动数字化转型