# coding=gbk
import random
import fractions
import string
i=0
result=0
temp=0
print"Please enter the number of questions how many you want to generate"
n=input()
while i<n:
first_num=random.randint(1,10) #方法返回随机生成的一个实数,范围在(1,10)之间
second_num=random.randint(1,10)
third_num=random.randint(1,10)
fourth_num=random.randint(1,10)
a = random.choice("+-*/")
if second_num==1: #用if语句生成公式内的数字
x=first_num
else:
x=fractions.Fraction(first_num,second_num)
if fourth_num==1:
y=second_num
else:
assert isinstance(fourth_num, object)
y=fractions.Fraction(second_num,fourth_num)
if a=="+": #用if循环生成+,-,*,/,这四个算数
result=x+y
faker=str(result)
print x,a,y,"="
elif a=="-":
result=x-y
faker=str(result) #生成字符型
print x,a,y,"="
elif a=="*":
result=x*y
faker=str(result)
print x,"x",y,"="
elif a=="/":
result=x/y
faker=str(result)
print x,"/",y,"="
answer=raw_input()
if faker ==answer: # 判断答案是否正确
temp=temp+1
print "right'!'"
else: # 判断答案是否错误
print 'error. the right answer is %s' % result
i += 1
print "there are %d question you are right answer" % temp