课后作业-结对编程项目总结
我对代码会的不是很多,很多情况下,都是组长高鲁莹带着我来在写这个代码,完成这个项目
值得高兴的是,已经能运行这个简单的四则运算程序了,虽然可能有点简单,但是已经很高兴了
因为毕竟是一点一点琢磨出来的,也能吧之前的学过的只是运用到里面,还是很有成就感的
没有截图是因为电脑阿勒泰键不好用了!!!希望能原谅我这次作业的小瑕疵。
#_*_coding:utf-8_*_
import string
import random
input=11
nums=10
num=0
righ1t=0
flagwrong=0
print "一共有%d道题目:"%(nums)
while True:
flagwrong=0
if num>=nums:
print "一共做对了%d道/%d道 题目"%(righ1t,nums),
if righ1t>=10:
print "100分!"
elif righ1t>=8:
print "80分!"
else:
print "继续努力!"
break;
elif num<nums:
num=num+1
x=random.randint(1, 100)
y=random.randint(1, 10)
print ""
symbol=random.randint(0,3)
if 0==symbol:
print "第%d题:%d+%d="%(num,x,y),
input=raw_input()
intp=string.atoi(input)
print intp
while intp!=(x+y):
print "错误 %d+%d不等于%d"%(x,y,intp)
flagwrong=1;
print "再算一遍,第%d题:%d+%d="%(num,x,y),
input=raw_input()
intp=string.atoi(input)
if intp==x+y:
break;
continue;
if intp == (x+y):
print "正确 %d+%d就是等于%d"%(x,y,intp)
if flagwrong==0:
righ1t=righ1t+1
continue;
break;
elif 1==symbol:
if x<y: x01temp=x; x=y; y=x01temp;
print "第%d题:%d-%d="%(num,x,y),
input=raw_input()
intp=string.atoi(input)
print intp
while intp!=(x-y):
print "错误 %d-%d不等于%d"%(x,y,intp)
flagwrong=1;
print "再算一遍,第%d题:%d-%d="%(num,x,y),
input=raw_input()
intp=string.atoi(input)
if intp==x-y:
break;
continue;
if intp == (x-y):
print "正确%d-%d就是等于%d"%(x,y,intp)
if flagwrong==0:
righ1t=righ1t+1
continue;
break;
elif 2==symbol:
#if x<y: x01temp=x; x=y; y=x01temp;
print "第%d题:%d*%d="%(num,x,y),
input=raw_input()
intp=string.atoi(input)
print intp
while intp!=(x*y):
print "错误 %d*%d不等于%d"%(x,y,intp)
flagwrong=1;
print "再算一遍,第%d题:%d*%d="%(num,x,y),
input=raw_input()
intp=string.atoi(input)
if intp==x*y:
break;
continue;
if intp == (x*y):
print "正确!%d*%d就是等于%d"%(x,y,intp)
if flagwrong==0:
righ1t=righ1t+1
continue;
break;
elif 3==symbol:
if x<y: x01temp=x; x=y; y=x01temp;
print "第%d题:%d/%d="%(num,x,y),
print "商:",
input=raw_input()
intp=string.atoi(input)
print "余数:",
input2yushu=raw_input()
intp2yushu=string.atoi(input2yushu)
print "商:",
print intp,
print "余数:",
print intp2yushu
while x !=( ( intp * y)+intp2yushu ):
print "错误 %d/%d不等于商%d,余%d !"%(x,y,intp,intp2yushu)
flagwrong=1;
print "再算一遍,第%d题:%d/%d的商=?"%(num,x,y),
input=raw_input()
intp=string.atoi(input)
print "余数:",
input2yushu=raw_input()
intp2yushu=string.atoi(input2yushu)
if x ==( intp*y + intp2yushu ):
break;
continue;
if x == ( (intp*y)+intp2yushu ):
print "正确 %d/%d就是等于商%d,余%d !"%(x,y,intp,intp2yushu)
if flagwrong==0:
righ1t=righ1t+1
continue;
break;
num=0