加法生成
作者:互联网
import random for i in range(20): while True: aa = random.randint(0, 30) bb = random.randint(0, 30) if aa + bb >= 30: continue else: while True: jiego = int(input("%d+%d=" % (aa, bb))) cc = aa + bb if jiego == cc: print("恭喜你答对了") print("开始下一题") break else: print('答错了请重新输入') continue # print("%d+%d="%(aa,bb)) break print('恭喜你答完了,100分')
标签:aa,30,bb,randint,random,生成,加法,print 来源: https://www.cnblogs.com/xiaobaixuecheng101/p/16583370.html