-1

I have created a very very basic code that prints out the vowels that are in your name when you give it your name.The only problem is that when the code runs there is "none" in the terminal. I tried adding a break and a return at the end of the for statment, but it still showed none.

vowels = 'aeiou'

def meaning(fname):
    for letter in vowels:
        if letter in fname:
            print(letter)

    return
print(meaning(fname = input("What is your name: ")))

No matter what I add to the end of the for statement it always prints out None I'm not sure if it's because the for loop reaches the end of fname, even if that was the case i'm not sure how to deal with it. im sorry if this is an easy fix, I'm really new to coding.

Ed_
  • 1

1 Answers1

0

If you want to return a value, you need to include it after the return, or you return an empty value None.

def meaning(fname):
    for letter in vowels:
        if letter in fname:
            print(letter)

    return fname
Kexus
  • 659
  • 2
  • 6
  • 13
  • But I don't want to return any value to ```fname function``` I want to vowels of the input the user gives to be printed, no matter where I put ```return``` it shows and outcome in terminal. Im starting to think that there is another way without for loop. – Ed_ May 08 '20 at 19:42
  • @Ed_ In that case, remove the print from `print(meaning(fname = input("What is your name: ")))` – Kexus May 08 '20 at 20:03