Jan-06-2020, 11:27 PM
1 2 3 4 5 |
def search4vowels(word): vowels = set ( 'aeiou' ) found = vowels.intersection( set (word)) for vowel in found: print (vowel) |
def search_for_vowels():
|
||||||||||
Jan-06-2020, 11:27 PM
The code you've provided defines a function. It doesn't do anything else. Barring a SyntaxError, you're not really going to get errors from just defining a function. Please provide your full code, that actually produces (I expect) a NameError. If your full code is long (>10 lines) I highly suggest you simplify your code until it's as simple as possible while reproducing your issue.
Jan-07-2020, 10:07 PM
(Jan-07-2020, 12:38 AM)micseydel Wrote: The code you've provided defines a function. It doesn't do anything else. Barring a SyntaxError, you're not really going to get errors from just defining a function. Please provide your full code, that actually produces (I expect) a NameError. If your full code is long (>10 lines) I highly suggest you simplify your code until it's as simple as possible while reproducing your issue. I know it defines a function. When I call it with a word it gives the error.
Jan-07-2020, 10:53 PM
(Jan-07-2020, 10:07 PM)Dixon Wrote: I know it defines a function. When I call it with a word it gives the error.I copied your function into the Idle shell and called it and it ran perfectly.
Please provide the calling code.
Jan-07-2020, 11:36 PM
Clunk_Head was quite clear, but I want to make sure you understand: we're not asking for this out of a whim, we want to help you and you haven't helped us enough to do so. We really do want to help, but we can't do so without what we're asking for.
Jan-09-2020, 10:21 PM
Yes, it works for me too now. I must have called it improperly yesterday. Thanks for the responses guys.
(Jan-06-2020, 11:27 PM)Dixon Wrote: Gives a Traceback name error when trying to invoke: "name 'search4vowels' not defined. This happens if you call your function, before it's defined. Example:
This works:
By the way, your code works:
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians! | ||||||||||
|