weird result for a product of two integers
I'm facing an issue. either I'm blind and can't see something abious or there is a type issue of my variables. I set this little code to illustrate what I am trying to fix
exp="khjkmqSDVB KNÙsdhgvd elgjvaolfba barmknham:baDB?Z?dbk,are bafbmao\
lfba barmknham:baDB?Z?N NBZRLHKMZRKHNZMB;ZGFKHZRPKolfba barmknham:baDB?\
Z?HTNPZKGJolfba barmknham:baDB?Z?ZPEROYAÉALZTIYUHNGKEG\
jkmqSDVB KNÙsdhgvd elgjvaolfba barmknham:baDB?Z?dbk,are bafbmao\
lfba barmknham:baDB?Z?N NBZRLHKMZRKHNZMB;ZGFKHZRPKolfba barmknham:baDB?\
Z?HTNPZKGJolfba barmknham:baDB?Z?ZPEROYAÉALZTIYUHNGKEG\
jkmqSDVB KNÙsdhgvd elgjvaolfba barmknham:baDB?Z?dbk,are bafbmao\
lfba barmknham:baDB?Z?N NBZRLHKMZRKHNZMB;ZGFKHZRPKolfba barmknham:baDB?\
Z?HTNPZKGJolfba barmknham:baDB?Z?ZPEROYAÉALZTIYUHNGKEG"
nb = len(exp)//40
t= mod(len(exp),40)
print("length of exp = " + str(len(exp)))
print("nb = " + str(nb))
print("t = " + str(t))
print("nb x 40 = " + str(nb*40))
print("t + (40 x nb) = " + str(t + nb*40))
print(nb, t, nb*t)
Everything go right until the last expression
print("t + (40 x nb) = " + str(t + nb*40))
This is what I am getting (restarted the kernel jut-in-case)
Out[1]:
length of exp = 566
nb = 14
t = 6
nb x 40 = 560
t + (40 x nb) = 6
14 6 4
Thx for the one who'll see what's wrong.
to know more about the type of some variable
v
, in particular the ring in which it lives, useparent(v)
here
t
belongs to a finite ring, not to the integer ringIf you want an integer version, you could use
t = len(exp) % 40
.thx this what I ended up doing. appreciated