![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
简明python教程
JanFangZ
坚持,坚持就好了!
展开
-
python(函数)
函数 函数_functions是指克重复使用的程序片段。#function1.pydef say_hello(): print('Hello world')say_hello()say_hello()输出:Hello worldHello world函数参数#function_param.pydef print_max(a,b): if a > b: pr原创 2017-08-29 12:05:53 · 281 阅读 · 0 评论 -
python(基础)
基础print("hello world")#注意到print这是一个函数help('len')help('return') 代码会告诉你怎么做,注释会告诉你为何如此。字面常量常量,值不能改变51.23This is a string #文本数字 整数 (integers) 浮点数 (floats) int类型可以指任何大小的整数 33.2352.3E-4 # 52原创 2017-08-27 11:35:47 · 182 阅读 · 0 评论 -
python(运算符和表达式)
运算符和表达式表达式(Expression)=运算符(Operators)+操作数(Operands)运算符+ - * /** (乘方)//(整除)% (取余 15%2=1)<<(左移) >>(右移)& | ^ ~ (按位)< > <= >= == !=not and or (布尔)数值运算和赋值的快捷方式a = a * 3a *= 3求值顺序万事注意用括号(也不知道听谁说的,总觉原创 2017-08-29 10:36:49 · 330 阅读 · 0 评论 -
python(控制流)
控制流ifwhileforbreakcontnueif 语句 如果条件为真,我们将运行if-block,否则我们将运行else-block。#if.pynumber=23guess=int(input('Enter an integer : '))#input()讲义字符串的形式返回我们所输入的內痛,然后我们通过int将这个字符串转换为一个整数并将其存储在变量guess中。原创 2017-08-29 11:00:02 · 277 阅读 · 0 评论