while循環(huán)語句100以內(nèi)奇數(shù)和 Python使用random函數(shù)計算100以內(nèi)加減法,沒有題數(shù)限制的那種?
Python使用random函數(shù)計算100以內(nèi)加減法,沒有題數(shù)限制的那種?import randommax_n=100i=0,為真時:i=1#隨運0,1-op=隨機(jī).randint(0,1)#如果op
Python使用random函數(shù)計算100以內(nèi)加減法,沒有題數(shù)限制的那種?
import randommax_n=100i=0,為真時:i=1#隨運0,1-op=隨機(jī).randint(0,1)#如果op==0:x1=隨機(jī).randint(0,最大值)x2=隨機(jī).randint(0,最大值u n-x1)結(jié)果=x1 x2 qst=str(x1)“”str(x2)“=”問題=[qst,結(jié)果]#-elif op==1:x1=隨機(jī).randint(0,最大值)x2=隨機(jī).randint(0,x1)result=x1-x2 qst=str(x1)“-”str(x2)“=”question=[qst,result]x=input(“第{:>2d}題:{}”。format(i 1,question[0])if int(x)==int(question[1]):print(“回答正確!”),否則:打印(“x”“x”“x”“x”“x”“x”“x”“x”“x”“x”“x”“x”“x”“x”“x”“x”“x”“x