import random import pgzrun WIDTH = 960 HEIGHT = 720 bg = Actor('bg2.png') start = Actor('start.png',(140,580)) end = Actor('end.png',(320,580)) ping = Actor('ping.png',(230,400)) score = ['100','200','300','400','500','600','700','800','900', '1000'] result = ' ' flag = 1 def draw(): bg.draw() start.draw() end.draw() ping.draw() screen.draw.text(result,fontsize = 40,center = (230,400),color='red') num = 0 def change(): global num,result num += 1 if num > 27: num = 0 result = random.choice(score) def on_mouse_down(pos): global result,flag if start.collidepoint(pos) == True: clock.schedule_interval(change, 0.1) result = '' flag = 0 if flag == 0: if end.collidepoint(pos) == True: clock.unschedule(change) result = getn() flag = 1 music.play_once('抽奖.mp3') pgzrun.go()
t=input() t=int(t) if t>=15: print('加强')
# for 循环 for i in range(10): print('程语欣')
h = 0.0001 for i in range(42): h=h*2 print(h)
# random 随机模块 randint() 随机整数 import random number=random.randint(1,100) print(number)
# random 随机模块 randint() 随机整数 int()转整形 import random guess=input('请输入1-100之间的整数') guess=int(guess) number=random.randint(1,guess) print(number)
# random 随机模块 randint() 随机整数 import random guess=input('请输入1-100之间的整数') guess=int(guess) number=random.randint(1,guess) if guess==number: print('猜对了') elif guess<number: print('猜小了') elif guess>number: print('猜大了')
import random n = random.randint(1, 10) while True: g = input('请输入一个1~10之间的整数') if g == None: break g1 = int(g) if g1 == n: print('猜对了', '1.png') # 结束循环 elif g1 < n: print('猜小了', '2.png') elif g1 > n: print('猜大了', '3.png')
标签:guess,草稿,randint,random,result,print,png From: https://www.cnblogs.com/klmyoil/p/18593921