Integer result for fraction
Hi!
Can somebody explain me this strange behavior of Sage :
for p in range(1,10):
for q in range(1,10):
print p/q
Then p/q
return the integer division.
However:
for p in range(1,10):
print p/7
give rational results.
A solution is to use Rational(p)/Rational(q)
instead of p/q
. But it is not an explanation.
Thanks,
Arnaud
In working with Sage you have to know if you are dealing with a Sage integer or Python integer. They behave differently. Use srange as indicated in answer below. See also, this similar post