Q. Input a string having some digits. Write a function to return the sum of digits present in this string.
Answer :-
def path( string ):
digit = 0
for i in string :
if i.isdigit():
digit += int( i )
return digit
string = input("Enter a String :-")
print("Sum of Digit :-", path(string) )
Thank you
ReplyDeleteWelcome 😊😊😊
DeleteUnderstanding
ReplyDelete??
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )