程序
xu_135time
天行健,君子以自强码字。
展开
-
多种弹框(进阶)
# 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 · 113 阅读 · 0 评论 -
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 · 97 阅读 · 0 评论 -
如何使用pygame制作游戏
便宜game下载途径不用多说,别的地方有,下面上代码。import sys,pygame,randomfrom 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 · 706 阅读 · 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 · 27343 阅读 · 0 评论 -
循环嵌套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=0m=0mm=0mmm=0for i in原创 2021-05-26 17:46:06 · 71 阅读 · 0 评论 -
python turtle五星红旗
今天是疯狂写博的一天,望三连!!!import turtleimport randomturtle.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 · 1062 阅读 · 0 评论