+ 1
Why is it that the input ab is the same thing twice
import random input = str(input("")) key = random.randint(123, 9999999) def encode(v): v = v * key v =+ key v = str(v) v = v + ' ' return(v) a = encode(1) b = encode(2) c = encode(3) d = encode(4) output = input.replace("a", a).replace("b", b) print(output)
1 Odpowiedź
0
You overwrite v with the constant value of key instead of adding it:
v += key
Random key with seed within the function helps too...