摘要:
def getText(): #赋予txt哈姆雷特小说-全英文小写-全符号变空格-返回txt txt = open('C:/Users/eternal/Desktop/hamlet.txt','r').read() #路径要选好 txt = txt.lower() for ch in '!"#$%& 阅读全文
摘要:
x = 0 #循环变量ls = [] #创建列表while x == 0: shuru = input() if shuru == '': x = 1 #中断while else: ls.append(eval(shuru)) #增加元素he = 0 #和fangchahe = 0 #方差zhong 阅读全文
摘要:
import turtledef koch(size,n): if n == 0: turtle.fd(size) #如果n=0画直线 else: for angle in [0,60,-120,60]: #n>0时直线不是直线,变成了-/\-这种形状 turtle.left(angle) koch 阅读全文
摘要:
count = 0def hannuota(n,src,dst,mid): #n是圆盘数,src是起始,dst是目标,mid是过度 global count if n == 1: print('{}:{}->{}'.format(1,src,dst)) #当圆盘是1时,从起始柱子移到目标柱子 cou 阅读全文
摘要:
import turtle #画画库import time #时间库def drawGap(): #每个数码管距离,弄成像数码管 turtle.penup() turtle.fd(5)def drawLine(draw): #单个数码管 drawGap() turtle.pendown() if d 阅读全文
摘要:
import randomi = 0 #循环变量count1 = 0 #圆内点count2 = 0 #外while i < 10000000: #循环次数 xzuobiao = random.random() #随机x坐标,0.0-1.0 yzuobiao = random.random() #y 阅读全文
摘要:
a = input()if a[0:3] == 'RMB': renminbi = eval(a[3:]) fff = renminbi /6.78 print('USD{:.2f}'.format(fff))elif a[0:3] == 'USD': meiguobi =eval(a[3:]) c 阅读全文
摘要:
1、第一次试验 s , t = input() print('{0},{1}'.format(s,t)) #对于上述代码,输入1,2会发生错误 #发生ValueError: too many values to unpack (expected 2)这种错误 2、第二次试验 s , t = eval 阅读全文
摘要:
shengao = eval(input('请输入以米为单位的身高(例:1.75):'))tizhong = eval(input('请输入以公斤为单位的体重(例:60):'))BMI = tizhong / (shengao**2)if BMI<18.5: print('BMI指数为{:.2f}, 阅读全文
摘要:
首先下载pyinstaller 下载地址:http://www.pyinstaller.org/downloads.html 我的是windows操作系统,所以我选择了支持3.6版本的zip格式文件 下载解压到一个盘里 然后进入CMD,进入刚刚解压的文件夹里,然后输入python setup.py 阅读全文