I've tried to write a function which tries if the GCD of the variable 'a' and 26 is 1, and if not then return the variable pgcd as True in order to quit a 'While'. But the function doesn't change the value of pgcd which stays False so it stays into the 'While'. I don't understand why the value isn't change. Could you help me :)
def couplepgcd(pgcd):
try:
assert gcd(a,26) == 1
pgcd = True
except Exception:
print("a et 26 doivent être premiers entre eux !")
return pgcd
...
pgcd = False
while pgcd == False:
[...]
couplepgcd(pgcd)