2022-10-20 21:22:14 +00:00
|
|
|
def main():
|
2022-11-10 23:20:38 +00:00
|
|
|
print(countDigits("far4214faewf13")) # Tem de dar 6
|
|
|
|
|
2022-10-20 21:22:14 +00:00
|
|
|
|
|
|
|
def countDigits(string):
|
|
|
|
count = 0
|
|
|
|
for char in string:
|
2022-11-10 23:20:38 +00:00
|
|
|
if char.isdigit():
|
2022-10-20 21:22:14 +00:00
|
|
|
count += 1
|
|
|
|
return count
|
2022-11-10 23:20:38 +00:00
|
|
|
|
|
|
|
|
2022-10-20 21:22:14 +00:00
|
|
|
if __name__ == "__main__":
|
2022-11-10 23:20:38 +00:00
|
|
|
main()
|