Python
HiJack¹
-
Python——线性模型及可视化
import numpy as npimport matplotlib.pyplot as pltfrom matplotlib import cmfrom mpl_toolkits.mplot3d import Axes3D#数据x_data = [1.0, 2.0, 3.0, 4.0, 5.0]y_data = [9.0, 17.0, 25.0, 33.0, 41.0] # 模型y = 8x+1#线性函数def linearFun(x): return w*x+b原创 2021-05-22 20:20:02 · 1979 阅读 · 0 评论 -
Ptyhon——无角正方形(熟悉turtle库)
#Python 3.6 (32-bit)import turtleturtle.setup(500,500,20,30)turtle.pensize(20)turtle.penup()turtle.fd(-150)turtle.pendown()turtle.right(90)turtle.penup()turtle.fd(50)turtle.pendown()turtle...原创 2018-10-24 14:17:38 · 10131 阅读 · 1 评论 -
Python——随机生成规定数量密码
#Python 3.6 (32-bit)import random,stringcount = input('请输入你要产生多少条密码:').strip()all_passwds = []for i in range(int(count)): num = random.sample(string.digits,1) #随机取1位数字 lower = random.sam...原创 2018-10-24 14:12:19 · 1020 阅读 · 0 评论 -
Python——绘制正方形螺线
#Python 3.6(32-bit)import turtleturtle.setup(500,500,20,30)turtle.color("blue")for x in range(100): turtle.fd(2*x) turtle.left(90)turtle.hideturtle()原创 2018-10-24 14:08:49 · 5278 阅读 · 0 评论 -
Python——猜数游戏
#Python 3.6(32-bit)from random import *z = randint(0,9) #生成从0到9的随机数t=0while t!=-1: n = eval(input("please input a number between 0~9:")) t=t+1 if n<z: #判断随机生成数...原创 2018-05-17 10:57:26 · 769 阅读 · 0 评论 -
Python——统计字符个数
#Python 3.6(32-bit)源代码如下:str = input("please input a string from your keyboard:") #用户输入字符eng=num=bla=oth=0 for i in str: ...原创 2018-05-17 10:46:12 · 10299 阅读 · 0 评论