一:
while True:
print("我是客走遗剑")
sleep(5)
sleep没导库!!是time库
from time import *
while True:
print("我是客走遗剑")
sleep(5)
二:
for i in range(10)
print("我是客走遗剑")
for 循环没加冒号!!
for i in range(10):
print("我是客走遗剑")
三:(最难)
import pygame
import random
SCREENSIZE=(600,600)
BLACK=(0,0,0,13)
pygame.init()
font = pygame.font.SysFont(宋体, 20)
screen = pygame.display.set_mode(SCREENSIZE)
surface = pygame.Surface(SCREENSIZE, flags=pygame.SRCALPHA)
pygame.Surface.convert(surface)
surface.fill(BLACK)
screen.fill(BLACK)
lib=[chr(i) for i in range(48,48+10)] + [chr(i) for i in range(97,97+26)]
texts = [font.render(l, True, (0, 255, 0)) for l in lib]
cols = list(range(40))
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit()
pygame.time.delay(33)
screen.blit(surface, (0, 0))
for i in range(n:=len(cols)):
text = random.choice(texts)
screen.blit(text, (i * 15, cols[i] * 15))
cols[i] = 0 if cols[i] >80 or random.random() > 0.95 else cols[i]+1
pygame.display.flip()
第6行没加引号!!(宋体那个)应为:
import pygame
import random
SCREENSIZE=(600,600)
BLACK=(0,0,0,13)
pygame.init()
font = pygame.font.SysFont('宋体', 20)
screen = pygame.display.set_mode(SCREENSIZE)
surface = pygame.Surface(SCREENSIZE, flags=pygame.SRCALPHA)
pygame.Surface.convert(surface)
surface.fill(BLACK)
screen.fill(BLACK)
lib=[chr(i) for i in range(48,48+10)] + [chr(i) for i in range(97,97+26)]
texts = [font.render(l, True, (0, 255, 0)) for l in lib]
cols = list(range(40))
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit()
pygame.time.delay(33)
screen.blit(surface, (0, 0))
for i in range(n:=len(cols)):
text = random.choice(texts)
screen.blit(text, (i * 15, cols[i] * 15))
cols[i] = 0 if cols[i] >80 or random.random() > 0.95 else cols[i]+1
pygame.display.flip()
懂了吗?
下期见,欢迎关注!!