0
Output a list of integers as a single integer
Hello. I'm looking for a solution to the following problem: my_list = [1,2,3] need to print 123 as a single number, or be able to save it in a variable for later usage I know how to do it with built in functions, and by using conversion to string then back to int, but I need the mathematical way of doing it. I know you are supposed to multiply the numbers by 100/10 but I cannot figure out how to do it in python. Solutions in other languages are welcome too. Thank you!
4 Réponses
+ 1
May be it helpful!
https://code.sololearn.com/c7FeTgz48x4u/?ref=app
If it helpful, then don't copy the code, try yourself.
+ 2
You just need to print the elements of the array from start to end. You can use a loop, increase the index and print the elements.
+ 2
Thank you, Vadivelan! That is exactly what I was looking for! I will not copy it, just study the logic behind the algorithm.
0
Yes, that works, but it is not what I'm looking for. I need the mathematical (algorithmic) way of "joining" those three integers together (1,2,3 -> 123)