Infinite looping and integer trouble

You start by calling Main(). Eventually Main() calls Count_Words_of_Length(). The first thing that function does is call Main(). Do you see the problem there? That's an infinite loop with no stopping condition.

Here's a better way of doing what you want:

def main():
    word_list = input("Enter phrase: ").split()
    length = int(input("Enter an integer: "))
    num_words = len(word_list)
    print(f'There are {num_words} words in your phrase')
    num_length = 0
    for word in word_list:
        if len(word) == length:
            num_length += 1
    print(f'There are {num_length} words of length {length} in your phrase')


if __name__ == "__main__":
    main()

Notice how main() is lowercase. That's a stylistic standard. Notice how the body of the script also has that conditional construction with the magic word __name__. This is just checking whether the script is being ran itself or it is being imported as a module. You don't need to do this, but if you're defining a main() function and calling that within the body of the script as you did, this is the standard pattern followed in Python and it is worth learning.

Note also these four lines...

num_length = 0
for word in word_list:
    if len(word) == length:
        num_length += 1

...would probably be replaced with a single-line, sum with generator expression like this:

num_length = sum(len(word) == length for word in word_list)

But that's less clear and obvious for a novice.

/r/pythonhelp Thread