Why do 'return bool' show different results in command prompt vs IDE

Question:

If I try the below code in command prompt , I get correct results, however, the same code using IDE(Atom) do not produce any results.

def search_for_vowels(word):
    """Display any vowels found in an asked for word"""
    vowels = set('aeiou')
    found = vowels.intersection(set(word))
    return bool(found)

search_for_vowels('galaxy')
Asked By: Praveen Paliwal

||

Answers:

Using the command prompt to code is different than using IDE. When you use the command prompt you use something called interpreter, it will execute every line you write right after you click enter. You can write an object like that:

search_for_vowels('galaxy')

And it will print its __repr__ to the screen.
In IDE it is not the case. It won’t print you the __repr__ of an object just be writing it. If you want to see the object or the function call result use print like that:

print(search_for_vowels('galaxy'))
Answered By: Eladtopaz
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.