Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

weired 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.

click to hide/show revision 2
None

weired 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.