Apr-29-2020, 11:24 AM
Your logic is kinda messed up.
Think of a function as a tool. Your main routine then uses that tool. To keep your tool flexible, you probably do not want to get input in that tool, rather to get input in the main routine (eliminate line 2, it is redundantly asking the user to repeatedly enter the sentence).
Then you conditionally create another tool, capital(), that you never use. Creating it does not use it. And, if len(newword) is say 10, you define that tool 5 times as the definition is inside a loop. Keep your function definitions outside of loops and outside of if statements.
As written, UpperVowels() does not return anything. Capital() does, but since it is never called the best you can hope for is nothing.
The parameters in a function definition are placeholders. If they have the same name as something elsewhere in the program then it is like two people with the same names. Same names, but different people. newword in the main routine and newword in your function are not the same.
Better to use unique variable names in your function to avoid this confusion. Remember the function is a tool, acting on parameters to give you a desired output.
Think of a function as a tool. Your main routine then uses that tool. To keep your tool flexible, you probably do not want to get input in that tool, rather to get input in the main routine (eliminate line 2, it is redundantly asking the user to repeatedly enter the sentence).
Then you conditionally create another tool, capital(), that you never use. Creating it does not use it. And, if len(newword) is say 10, you define that tool 5 times as the definition is inside a loop. Keep your function definitions outside of loops and outside of if statements.
As written, UpperVowels() does not return anything. Capital() does, but since it is never called the best you can hope for is nothing.
The parameters in a function definition are placeholders. If they have the same name as something elsewhere in the program then it is like two people with the same names. Same names, but different people. newword in the main routine and newword in your function are not the same.
Better to use unique variable names in your function to avoid this confusion. Remember the function is a tool, acting on parameters to give you a desired output.