I need to make a code with a FOR loop that will find all numbers in a string and then print out all the numbers. So far I have only been able to get the code to print out the first number that is found can you help me pleas?
here is my code:
def allNumbers(string):
for numbers in string:
if numbers.isdigit():
return numbers
When the program is run it should look something like this:
>>> allNumbers("H3llO, H0W 4R3 y0U")
'300430'
>>> allNumbers("Good morning.")
''
''