0

How do I concatenate two integers without changing the type

17th Sep 2016, 12:27 PM
POZEIDON Thomas
POZEIDON Thomas - avatar
3 Respuestas
+ 3
Convert the integers on the fly. a = 42 b = 1337 print(str(a) + str(b)) a and b are still integers here.
17th Sep 2016, 1:53 PM
Zen
Zen - avatar
+ 2
import math a=int(input("a: ")) b=int(input("b: ")) print("ab = {0}".format(a*(10**(int(math.log10(b))+1)) + b))
17th Sep 2016, 1:16 PM
Textobot
Textobot - avatar
0
a=2 print(a, +3) 23
20th Sep 2016, 3:11 PM
Ramanathan Raveendran
Ramanathan Raveendran - avatar