# 四则运算

import random
from fractions import Fraction

def newint():
opr = ['＋', '－', '×', '÷']
fh = random.randint(0, 3)
n1 = random.randint(1, 20)
n2 = random.randint(1, 20)
rjg = 0
if fh == 0:
rjg = n1 + n2
elif fh == 1:
n1, n2 = max(n1, n2), min(n1, n2)
rjg = n1 - n2
elif fh == 2:
rjg = n1 * n2
elif fh == 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)
rjg = int(n1 / n2)
print(n1, opr[fh], n2, '= ', end='')
return rjg

def newfra():
opr = ['＋', '－', '×', '÷']
fh = random.randint(0, 3)
t1 = random.randint(1, 10)
t2 = random.randint(t1, 10)
n1 = Fraction(t1, t2)
t1 = random.randint(1, 10)
t2 = random.randint(t1, 10)
n2 = Fraction(t1, t2)
rjg = 0
if fh == 0:
rjg = n1 + n2
elif fh == 1:
n1, n2 = max(n1, n2), min(n1, n2)
rjg = n1 - n2
elif fh == 2:
rjg = n1 * n2
elif fh == 3:
n1, n2 = max(n1, n2), min(n1, n2)
rjg = n1 / n2
print(n1, opr[fh], n2, '= ', end='')
return rjg

def newtest():
opr = ['＋', '－', '×', '÷']
print('输入题库所需要的题目数量')
n=int(input())
rjg=[]
m=0
while m<=(n-1):
fh = random.randint(0, 4)
if fh==0:
print(m+1,end='、')
rjg.append(newfra())
print(' ')
else:
print(m+1,end='、')
rjg.append(newint())
print(' ')
m=m+1
m=0
print('答案：')
while m<=(n-1):
print(m+1,'、',rjg[m])
m=m+1

print('1、四则运算')
print('2、制作题库')
n=int(input())
if n1:
print('input "0000" to Quit')
while True:
fh = random.randint(0, 4)
if fh == 0:
rjg = newfra()
jg = input()
if jg == '0000':
break;
sr = Fraction(jg)
if sr == rjg:
print('right')
else:
print('error. the Tight answer is', rjg)
else:
rjg = newint()
jg = input()
if jg == '0000':
break;
sr = int(jg)
if sr == rjg:
print('right')
else:
print('error. the Tight answer is', rjg)
if n2:
newtest()

psp2.1 任务内容 计划完成需要的时间（min） 实际完成需要的时间（min）
Planning 计划 5 5

Estimate 估计这个任务需要多少时间，并规划大致工作步骤 8 15
Development 开发 120 125
Analysis 需求分析（包括学习新技术） 15 5
Design Spec 生成设计文档 10 5
Design Review 设计复审 5 5
Coding Standard 代码规范 2 2
Design 具体设计 10 12
Coding 具体编码 40 45
Code Review 代码复审 5 7
Test 测试（自我测试，修改代码，提交修改） 10 15
Reporting 报告 10 15
Test Report 测试报告 5 3
Size Measurement 计算工作量 4 3
Postmortem & Process Improvement Plan 事后总结，并提出过程改进计划 5 2

posted @ 2020-11-04 16:16  EmperorSky  阅读(44)  评论(0编辑  收藏  举报