Solving The Only First Value Issue In Python Functions With Nested Loops