搜索[8'"],共找到36个文章
用Python学数学(二)
用类构建对象弹跳球程序让小球动起来 xcor = 300 ycor = 300 xvel = 1 yvel = 1 def setup(): size(600,600) def draw(): global xcor,ycor,xvel,yvel background(0) xcor += xvel ycor...
Python学数学(一)
用几何学变换形状 translate(50,80) # 会将整个网格向右移动50像素,向下移动80像素 #将图形绕着原点进行旋转 rotate() #参数为弧度 rotate(radians(20)) #将角度转换为弧度 画一个圆圈图案 def...
Python并发编程
并发编程多任务高并发:CPU核数很少,但是进程很多高并行:CPU的核实要比进程数量一致,进程同时运行多进程程序:程序是一个指定的集合进程:正在执行的程序程序开始运行时,首先会创建一个主进...
2.使用Pygame
使用pygame我们可以使用pygame在屏幕当中绘制一个文本出来import pygame from pygame.locals import* import sys pygame.init() screen = pygame.display.set_mode((400,300)) #绘制文本 myfont...
5.字符串和文本(二)
从字符串中去掉不需要的字符使用strip()来去除字符串两边的字符使用lstrip()来去除左边字符使用rstrip()来去除右边的字符s = ' hello,world,' #去除空格 print(s.strip()) #去除右边的符号 prin...
2.数据结构和算法(二)
将键映射到多个值当中#一般的创建方法 d = { 'a':[1,2,3], 'b':[4,5,6] } #使用defaultdict创建字典>>> import collections >>> import collections >>> d = defaul...