You are given a mixed list containing strings, numbers, and other lists, like the following: ["apple", 1, [2, 3], 3.4, "toy", ["cat", "dog"]]. You are writing a program to print the string items only. What is the missing line in the code below?
def get_strings(list):
for a in list:
/**missing code**/
print(a)
get_strings(["apple", 1, [2, 3], 3.4, "toy", ["cat", "dog"]])
if a == str:
if a == str(a):
if a != int(a):
if a is string:
Still Need Help?
Join the QuestionCove community and study together with friends!
Sign Up
kekeman:
I was most definally thinking "if a == str(a):"
kekeman:
Another question:
After you have found out how to find a prime number from a given set of numbers, what is the next step in designing a program?
Analyzing the hardware requirements for the coding
Selecting the best data structure to store numbers
Studying the literature that deals with the prime numbers
Typing a pseudocode that provides the solution
SmokeyBrown:
@kekeman wrote:
I was most definally thinking "if a == str(a):"
Yeah, I think that could work
SmokeyBrown:
@kekeman wrote:
Another question:
After you have found out how to find a prime number from a given set of numbers, what is the next step in designing a program?
Analyzing the hardware requirements for the coding
Selecting the best data structure to store numbers
Studying the literature that deals with the prime numbers
Typing a pseudocode that provides the solution
I would say the very next step after figuring out the process that a program takes to get to a solution would usually be to organize that solution in the form of pseudocode