Write a function called "num_changer" that accepts a string of digits (0-9). You should make an integer from the digits of the even indices and another number from the digits in the odd indices. Return the sum of these two numbers. You can assume the given string will have a length of at least 2 digits.
For example, if the string was "123456", you would split this into two integers, 135 and 246. Adding them would give 381. Or if the string was "13579", you would split this into 159 and 37, then add them to get 196.
#Below are some lines of code that will test your function.
#You can change the value of the variable(s) to test your function with different inputs.
#If your function works correctly, this will originally
#print: 123456 -> 381
string_int = "123456"
result = num_changer(string_int)
print(string_int + " -> " + str(resul
Answers
Answered by
0
Answer:
write a short note on e-mail and it's uses
Similar questions