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)
Answer =
string = input("Enter a string :-")
sum = 0
for i in string:
sum += int(i)
print("Sum of digit :-",sum)
Output please
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )