List input doubt

as list contain both string and numbers in it so if we have to take both string and number as an input in the list. then what should we use

Hey @Coder_sash2123, you can do the following :

  1. First input the whole string.
  2. Convert this string into a list using the split( ) function.
  3. Then you can traverse the list one by one and check if the element in the list is alphabet or not using the isalpha( ) function.
  4. If the isalpha() function returns false then you can convert that particular element into int.

Note : isalpha( ) function returns true if all characters in the string are alphabet.

Hope you understand this well !
Happy coding :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.