PS 2021解決未經簽署問題,PS 2021外掛未經簽署怎麼解決
阿新 • • 發佈:2020-11-29
執行程式碼:
import random
四則運算
def t():
sym = ['+', '-', '×', '÷']
f= random.randint(0, 3)
n1 = random.randint(1, 20)
n2 = random.randint(1, 20)
result = 0
if f== 0:#加法
result = n1 + n2
elif f == 1:#減法,要先比較大小,防止輸出負數
n1, n2 = max(n1, n2), min(n1, n2)
result = n1 - n2
elif f== 2:#乘法
result = n1 * n2
elif f == 3:#除法,要比較大小,並迴圈取整除
n1, n2 = max(n1, n2), min(n1, n2)
while n1 % n2 != 0:
n1 = random.randint(1, 10)
n2 = random.randint(1, 10)
n1, n2 = max(n1, n2), min(n1, n2)
result = int(n1 / n2)
print(n1, sym[f], n2, '= ', end='')
return result
def test():
print('輸入所需要的題目數量')
n=int(input())
result =[]
m=0
while m<=(n-1):
print(m+1,end='、')
result .append(t())
print(' ')
m=m+1
m=0
print('對應的答案:')
while m<=(n-1):
print(m+1,'、',result [m])
m=m+1
print('選擇想要的模式')
print('1、進行四則運算')
print('2、製作題庫')
n=int(input())
當輸入1時,進行四則運算,呼叫函式t()
if n1:
while True:
result = t()
j= input()
s= int(j)
if s
print('right')
else:
print('error.,the answer is', result )
當輸入2時,進行製作題庫
if n==2:
test()