当前位置:网站首页>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
边栏推荐
- Unparseable date: 'mon Aug 15 11:24:39 CST 2016', time format conversion exception
- Windows subsystem Ubuntu installation
- 16. File transfer protocol, vsftpd service
- The real-time display of CPU and memory utilization rate by Ubuntu
- Wechat nickname Emoji expression, special expression causes the list not to be displayed, export excel error report and other problems solved!
- The most detailed usage guide for perconaxtradbcluster8.0
- sed之查找替换
- Android Basics - RadioButton (radio button)
- Bili Bili common API
- SQL Server 2008R2 18456 error resolution
猜你喜欢

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

Astra: the future of Apache Cassandra is cloud native

Judging whether paths intersect or not by leetcode

SQL Server 2008R2 18456 error resolution

Simple use of future in Scala

FORTRAN 77 reads some data from the file and uses the heron iteration formula to solve the problem

FORTRAN77从文件中读入若干数据并用heron迭代公式开方

16.文件传输协议、vsftpd服务

On the stock trading of leetcode

China Telecom announces 5g SA commercial scale in 2020
随机推荐
面部识别:攻击类型和反欺骗技术
Brief history of computer
wanxin金融
nvm
Got timeout reading communication packets解决方法
The road of cloud computing: a free AWS cloud server
Wanxin Finance
LadonGo开源全平台渗透扫描器框架
2020-11-07:已知一个正整数数组,两个数相加等于N并且一定存在,如何找到两个数相乘最小的两个数?
数据科学面试应关注的6个要点
归纳一些比较好用的函数
Judging whether paths intersect or not by leetcode
The real-time display of CPU and memory utilization rate by Ubuntu
UCGUI简介
Wechat applet request reported 400 error @ requestbody failed to receive
Macquarie Bank drives digital transformation with datastex enterprise (DSE)
GET,POST,PUT,DELETE,OPTIONS用法与说明
分布式共识机制
use Xunit.DependencyInjection Transformation test project
Python3.9的7个特性