猫史档案馆


少幽科技

少幽科技

Lv.1

获赞:2收藏:1浏览:16作品收藏:6
回复帖子评论
上一页1 页 / 共 2下一页

【Python作品分享】肥不垃圾 中回复

import functools
@functools.lru_cache()
def fib(x):
    if x<=2:
        return 1
    return fib(x-1)+fib(x-2)

这个数据一大就慢了,改进了下

2019-10-13T12:20:01 点赞:0

怎么加角色 中回复

?

 

2020-02-20T12:41:29 点赞:0

【Python作品分享】计时器【作业帖】 中回复

错了,

__repr__ = __str__

应该为

def __repr__(self):
    return Mytimer.__str__(self)

2020-02-21T18:04:08 点赞:0

121的2进制是? 中回复

dd

2020-02-23T17:25:31 点赞:0

对手太弱了 中回复

几段啊

2020-02-25T10:07:19 点赞:0

【Python作品分享】彩色弹球 中回复

center_image

2020-03-04T16:03:13 点赞:0

林克杯[发金币]Python挑战! 中回复

center_image

2020-03-06T21:09:32 点赞:0

求大神修复!我输了这行代码,报错SyntaxError: invalid syntax 中回复

line 7, line 11 少个括号

 

2020-03-06T21:37:30 点赞:0

第一届林克杯完美结束!快来看看你是几等奖! 中回复

我发了4个作品,你买一下吧

2020-03-07T13:37:20 点赞:0

跪求。。。。。。 中回复

print(reduce(lambada x,y:x*y,list(map(int,input.split()))))

2020-03-07T14:32:57 点赞:0

海龟编辑器python,等待代码怎么写 中回复

import time

time.sleep(sec)

2020-03-11T16:04:36 点赞:1

【海龟编辑器】第三方库都是安装到哪里了?如何查看版本? 中回复

cMd命令 pip list

 

2020-03-14T17:00:18 点赞:0

【海龟编辑器】第三方库都是安装到哪里了?如何查看版本? 中回复

c M D

2020-03-14T17:00:28 点赞:0

【Python作品分享】一个极其普通的计算器1.3 中回复

没有backspace

 

2020-03-16T14:56:49 点赞:0

【Python作品分享】模拟微信抢红包【作品秀】 中回复

变量名起rob太秀了

 

2020-03-16T19:53:32 点赞:0

【Python作品分享】一个极其普通的计算器1.4【作品秀】 中回复

backspace图标像 小于绝对值的相反数

2020-03-17T14:02:34 点赞:1

计算器消息:下次更新会有些久,因为碰到了技术难题 中回复

什么难题?

2020-03-18T12:50:25 点赞:0

python萌新有问题,求大神解答 中回复

while 的w大写了

2020-03-18T21:03:10 点赞:0

【Python作品分享】判断一个数是不是9的倍数【作品秀】 中回复

所以说为什么不这么写呢 a%9==0?

2020-03-18T21:04:57 点赞:0

【python区的进来】最喵ython区很冷淡啊 中回复

确实

2020-03-27T10:33:58 点赞:0

【Python作品分享】班级分数统计(最高分、总分、品均分)【教程贴】 中回复

让我这样看你很爽吗?

2020-03-27T21:30:36 点赞:0

【Python作品分享】班级分数统计(最高分、总分、品均分)【教程贴】 中回复

center_image

2020-03-27T21:36:43 点赞:0

遇到一道难题,求大佬帮忙!!! 中回复

a,b=list(map(int,input().split())) for i in range(a*100,a*100+100):     if i%b==0:         print(i)

2020-04-06T18:52:32 点赞:0

遇到一道难题,求大佬帮忙!!! 中回复

a,b=list(map(int,input().split()))
for i in range(a*100,a*100+100):
    if i%b==0:
        print(i)

2020-04-06T18:52:42 点赞:0

遇到难题,求大佬解答!!! 中回复

#瞎写的,可能不简洁
cnt=-1
max=-1
ch=' '
st=input()
for c in st:
    cnt=st.count(c)
    if cnt>max:
        max=cnt
        ch=c
print(c)

2020-04-14T19:36:46 点赞:0

【Python作品分享】新的作品【教程贴】 中回复

这个是2005年找到的梅森素数,目前最大的是在2018年发现的

2^82,589,933-1

2020-04-15T16:28:39 点赞:0

Py代码猜猜看05 中回复

一、

import turtle
p=turtle.Pen()
p.speed(0)
for _ in range(360):
    p.forward(1)
    p.right(1)

 

2:

ABC
a
ABC
a
ABC
a
ABC
a

==报错==

 

3:

会停止运行

2020-04-18T15:51:53 点赞:0

一个想法(凑字数) 中回复

import pygame
from pygame.locals import *
from sys import exit
import copy

SIZE = 20
pygame.init()
screen = pygame.display.set_mode((SIZE*32,SIZE*32), 0, 32)
game = [[0 for i in range(SIZE)] for j in range(SIZE)]
game2 = [[0 for i in range(SIZE)] for j in range(SIZE)]


def show():
    for i in range(SIZE):
        for j in range(SIZE):
            if not game[i][j]:
                pygame.draw.rect(screen,(200,200,200),Rect(j*32,i*32,32,32))
            else:
                pygame.draw.rect(screen, (0,0,255), Rect(j * 32, i * 32, 32, 32))


def count(x,y):
    cnt=0
    for i in range(-1,2):
        for j in range(-1,2):
            if not i and not j:
                continue
            if is_legit(x+i,y+j):
                if game[x+i][y+j]:cnt+=1;
    return cnt


def is_legit(x,y):
    return 0<=x<SIZE and 0<=y<SIZE


def cal():
    global game,game2
    for i in range(SIZE):
        for j in range(SIZE):
            if count(i,j)==2:
                game2[i][j]=game[i][j]
            elif count(i,j)==3:
                game2[i][j] = 1
            else:
                game2[i][j] = 0
            # if(count(i,j)):
                # print("count:{},{}={}   game:{}".format(i,j,count(i,j),game2[i][j]))
    game=copy.deepcopy(game2)
    # print("==========")


setting = True
while True:

    for event in pygame.event.get():
        if event.type == QUIT:
            exit()
        if event.type == MOUSEBUTTONDOWN:
            a,b,c=pygame.mouse.get_pressed()
            if c:
                setting=False
                continue
            if setting:
                ex, ey = event.pos
                game[ey//32][ex//32] = not game[ey//32][ex//32]
            else:
                cal()
    show()
    pygame.display.update()

2020-04-18T21:05:55 点赞:0

5656565656[无聊代号] 中回复

pygame

2020-04-20T15:09:54 点赞:0

PY代码做做看 中回复

喵机:

print(2**2179381273987128937128973918)

import random
while(1):
    with open(str(random.randint(0,1203991820),"w") as f:
        f.write("sakjdhasjdhasjkhdkashdj\njshdkasjdhaskdhaskjhdkasjhdjkash\nsajdhaskdhasjkdhasjkdhaskhdjkashdajkshdjkahsdj")

2020-04-20T15:11:55 点赞:0