Welcome to the Treehouse Community
Looking to learn something new?
I understand how to use the isinstance() method to check for if it is a string , float , integer, etc, but I am not sure how to use it to solve the challenge
def combiner(["apple", 5.2, "dog", 8]):
Steven Parker215,972 Points
When defining your function, remember that it "takes a single argument, which will be a list". Then inside the function, you'll probably want a loop to go through the items in the list and use "isinstance" to test what kind of thing each one is, and process it based on that determination.
What have you tried? It doesn't look like you've taken any steps.
To solve a problem, you need to break it down into small steps. For example:
- start with an empty string variable
- and a number variable set to 0
- loop over the list
- for each item in the list
- if the item is a string
- add it to the string variable
- if the item is a number
- add it to the number variable
- after the loop,
- concatenate the number variable with the string variable (you'll have to do something to the number variable first)
- return the result
Can you try to implement the above in code?