The Python 3 code for the program described in the question:
def sum_digits(str):
sum = 0
for c in str:
sum += int(c)
return sum
def main():
print("Enter series of single-digit numbers with no spaces: ")
str = input()
print("The sum of digits of the entered number is", sum_digits(str))
main()