Get all the digits from the string.

In this program, we will take a string as input and get all the digits from the string.

Steps to solve the program
  1. Take a string as input
  2. Convert the string into a list using Split() and create an empty list.
  3. Use For loop to iterate over every word in the string.
  4. If the words contain all digits add the words to the empty list.
  5. Use isdigit() for this purpose.
  6. Print the new list.

Output :

re-arrange the string.

replace the words “Java” with “Python” in the given string.

Leave a Comment