Tuesday, 15 July 2014

string - How to combine variables with Python -



string - How to combine variables with Python -

this problem:

def encrypt(mult1, mult2): encrypted = mult1 * mult2 print (encrypted) encrypted_message = mult1, encrypted, mult2 print (encrypt_key) homecoming encrypt_key encrypt(frst, lst)

on line 4 (encrypted_message = mult1, encrypted, mult2) variable printed comes out each of variables spaced out, can tell variable which. how take away spacing create appear 1 variable?

try next

encrypted_message = "{0}{1}{2}".format(mult1, encrypted, mult2)

python string variables spacing

No comments:

Post a Comment