Q. Write a Python program to compute sum of digits of a given string.

 

Answer =

 



string = input("Enter a string :-")
sum = 0
for i in string:
    sum += int(i)
    
print("Sum of digit :-",sum)    

1 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post