结对-四则运算-结对项目总结
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了结对-四则运算-结对项目总结相关的知识,希望对你有一定的参考价值。
我们两个对于Python并不是很懂,过程中出现了很多问题,如果是让我自己一个人去完成这个“四则运算”,我肯定坚持不下来,刚开始打的时候就问题不断,连最基本的框架都会出现Bug,遇见Bug却怎么都改不过来的时候太多,改到头昏眼晕,想过好多次放弃,还好有小伙伴的鼓励和陪伴,我们两个学习成绩很一般,上学期一起做的的贪吃蛇是在团队的帮助下完成的,自己的存在感很低很低,而四则运算就我和爽两个人,还是很有存在感的。
#_*_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
以上是关于结对-四则运算-结对项目总结的主要内容,如果未能解决你的问题,请参考以下文章