In this program, we will take a string as input and get all the digits from the string.
Steps to solve the program
- Take a string as input
- Convert the string into a list using Split() and create an empty list.
- Use For loop to iterate over every word in the string.
- If the words contain all digits add the words to the empty list.
- Use isdigit() for this purpose.
- Print the new list.
Output :