- 博客(15)
- 资源 (1)
- 收藏
- 关注
原创 多种弹框(进阶)
# tk common message boxes # # this module provides an interface to the native message boxes # available in Tk 4.2 and newer. # options (all have default values): # # - default: which button to make default (one of the reply codes) # # - icon: which icon to
2021-08-16 12:15:54
186
原创 2021-07-04潜水艇
a=input().split(" ") b=int(a[0]) c=int(a[1]) d=input() e=len(d) for i in range(e): if d[i]=="u": if c-1>=0: c=c-1 elif d[i]=="d": if c+1<=b: c=c+1 print(c)
2021-07-04 11:29:12
160
原创 如何使用pygame制作游戏
便宜game下载途径不用多说,别的地方有,下面上代码。 import sys,pygame,random from pygame.locals import* pygame.init() def printtext(font,x,y,text,color=(155,155,155)): Text=font.render(text,True,color) screen.blit(Text,(x,y)) font2=pygame.font.SysFont('fangsong',24) pig
2021-07-01 17:27:23
829
3
转载 python创建二维数组方法
#Python# 二维数组的定义、使用的几种方法 通常的困扰 1、先介绍最简单的一种方式 2、再介绍最常见的一种方式 3、最后介绍最暴力直观的一种方式 通常的困扰 之前对Python里面创建、使用二维数组也很懵,于是也上网查了一些讲解,也发现一些类似的问题,大多数存在着 以为定义正确了二维数组,但修改数据的时候,发现数据经常一起串改。如: b=[[0,0,0]]*3 b[0][1]=1 #这里因为初始[0,0,0]可以这样写数据,如果初始空数组则不能 print(b) ...
2021-07-01 17:18:41
27742
原创 循环嵌套Python篇
如果有一只猫,每一站要吃一只鱼,车厢上有冰箱,可以储藏鱼,但是要付钱,问最少要多少钱?: 上代码: 其中a[],b[]是购买价格与储藏钱数,用了循环嵌套来完成。 a=[] b=[] A=int(input()) for i in range(A): c=input().split(" ") d=int(c[0]) e=int(c[1]) a.append(d) b.append(e) f=len(a) gs=0 m=0 mm=0 mmm=0 for i in
2021-05-26 17:46:06
152
原创 如何用python卡爆电脑
用tkinter加死循环不断制造窗口: import tkinter a=0 while a=0: wow=tkinter.Tk()
2021-05-25 20:42:17
1089
原创 2021-05-25沙雕程序
一段沙雕程序。 import time import random import tkinter import tkinter.messagebox import os,os.path print ("loading",end="") for i in range(0,1,1): time.sleep(1) print(".",end="") print("666") a=1 coin=0 mode=0 win=tkinter.Tk() win.title("Ad's World!
2021-05-25 20:28:38
157
原创 python turtle五星红旗
今天是疯狂写博的一天,望三连!!! import turtle import random turtle.setup(width=0.6,height=0.6) qw=(0.314,0.1428,0.11235) turtle.pencolor('red') we=(0.19,0.68,0) turtle.fillcolor('red') turtle.speed(10) turtle.begin_fill() for i in range(2): a=random.randint(1,360)
2021-05-25 20:26:02
1219
原创 数据综合处理——幸运号码抽奖
a=input() if a[3]=='-': b=a[0:3] c=int(a[4:12]) else: b=a[0:4] c=int(a[5:13]) print(b,c) if b=='010': d=0 else: d=1 cc=str(c) e=1 for i in range(8): if cc[i]=='8': e=0 if c%2==0: f=0 else: f=1 if c%3==0: g=0.
2021-05-25 20:19:29
309
原创 又是一段笔记
print() 打印数据 默认换行,不换行要加上 end="" #注释 ''' 注释1 注释2 ''' int 整数 bool 布尔 float 浮点数
2021-05-25 20:16:41
99
原创 自学的笔记
可变数据:list 列表 dictionary 字典 set 集合 不可变数据:number数学 string字符串 tuple 元组 abs(x) -10_10 ceil(x)4.1_5 fabs(x)-10_10.0 floor(x)4.9_4 max(x,y)最大 min(x,y)最小 modf(x)1.1_1.0 0.1 pow(x,y)x的y次方(x**y) round(x[,n])四舍五入到n位 sqrt(x)x平方根 ...
2021-05-25 20:13:36
167
原创 一段有点bug的游戏
废话少说,亮代码。` monster=(‘小火龙’,‘火恐龙’,‘喷火龙’) monster1={‘名字’:‘小火龙’,‘属性’:‘火’,‘生命’:‘C’,‘攻击’:‘C’,‘防御’:‘C’,‘速度’:‘D’,‘技能1’:‘小火球’,‘技能2’:‘撕咬’,‘技能3’:‘龙盾’} dishu={‘名字’:‘地鼠’,‘属性’:‘土’,‘等级’:2,‘生命’:99999,‘攻击’:100000,‘防御’:989,‘速度’:100,‘技能1’:‘碎石’,‘技能2’:‘撞击’,‘技能3’:‘硬化’} qwe=0 po
2021-05-25 20:11:46
226
1
原创 pyhon 之 登陆篇——os存档
import random import os,os.path try : os.remove("s") except OSError: print("检测到您为新用户,已为您新建。") print("注册:") nm=input("请输入账号名:") pin=input("请输入密码:") file_object=open("saving.txt","w") file_object.write(nm+pin) file_object.close() file_object=open("s.
2021-05-25 20:07:51
283
1
原创 turtle程序
一段turtle程序 import random A=0 B=0 C=0 D=0 E=0 F=0 gs=random.randint(4,6) aa=[] if gs==4: for i in range(0,15): D+=1 if D==2: D=0 C=C+1 if C==2: C=0 B=B+1 if B==2: ...
2021-05-24 21:15:20
318
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅