摘要:
转义字符 字符串运算符 注意:字符串只能和字符串进行相加操作 阅读全文
摘要:
python 中的没有 i++ ,如果写了会报语法错误。 但是python 中有 --i,++i,+-i,-+i,他们不是实现-1操作的,仅仅是作为判断运算符号,类似数学中的负负得正 i = 2 print ++i //2 print -+i //-2 print +-i //-2 print -- 阅读全文
摘要:
运算符// “ // ” 表示整数除法,返回整数 比如 7/3 结果为2 “ / ” 表示浮点数除法,返回浮点数 (即小数) 比如 8/2 结果为4.0 a = 11 // 3 print(a, type(a)) b = 11.0 // 3 # 数轴上的向左取整 print(b, type(b)) 阅读全文
摘要:
浮点数运算存在不确定尾数,有误差。可以用round()函数解决这个问题。 round()函数 round(x,n)方法将返回x的值,该值四舍五入到小数点后的n位数字。 当参数n不存在时,round()函数的输出为整数。 当参数n存在时,即使为0,round()函数的输出也会是一个浮点数。 此外,n的 阅读全文
摘要:
https://www.icourse163.org/learn/ZJU-1206456840 https://pintia.cn/problem-sets/1493440937782476800/problems/1493441031005814790 Python程序设计第一章(MOOC) 7- 阅读全文
摘要:
https://www.icourse163.org/learn/ZJU-1206456840 https://pintia.cn/problem-sets/1493440937782476800/problems/1493441031005814786 Python程序设计第一章(MOOC) 7- 阅读全文
摘要:
原码反码补码在线工具 https://www.23bei.com/tool/56.html 在线进制转换器: https://c.runoob.com/front-end/58/ 在线UTF-8编码转换: http://www.esjson.com/utf8Encode.html 16进制转32位有 阅读全文
摘要:
print()输出是默认换行的,可以加属性end使其不换行输出。 代码示例 for i in range(5): print(i) for i in range(5): print(i,end='') 控制台输出 0 1 2 3 4 01234 进程已结束,退出代码0 阅读全文
摘要:
input()的类型是str 代码示例 # 输入的都是字符串 a = input("请输入123:") print(a, type(a)) # 可以分割输入 a, b = input("请输入12 34:").split() print(a, type(a)) print(b, type(b)) # 阅读全文
摘要:
gcd,即Greatest Common Divisor的缩写,意为最大公约数 示例 import math num = math.gcd(12,8) print(num) 控制台输出 4 进程已结束,退出代码0 阅读全文