Let's say I have two integers, a = 123
and b = 4567
I want to make a function that will take these two integers and return 1425367
So far I've written this but it simply disregards the last number
Here's the code so far
Edit: I know I used str
but I don't know any other way to something question
def f(a,b): sa, sb = list(str(a)), list(str(b)) i, j = 0, 0 s = "" while i < len(sa) and j < len(sb): s += sa[i] s += sb[j] i += 1 j += 1 return s print(f(23,56))```
https://stackoverflow.com/questions/65783773/merge-two-number-with-the-integers-at-corresponding-position-together-without-u January 19, 2021 at 08:04AM
没有评论:
发表评论