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')
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'))
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')
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'))