def __str__(self): if self.p < self.q: k = self.p else: k = self.q for x in range(k, 0, -1): if self.p%x==0 and self.q%x == 0: self.p = self.p / x self.q = self.q / x break return '%s/%s' % (self.p, self.q)
添加回答
举报
0/150
提交
取消