Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add N-Dimensional Array Creator snippet #260

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Debanjan110d
Copy link

@Debanjan110d Debanjan110d commented Feb 16, 2025

Description

Type of Change

  • ✨ New snippet
  • πŸ›  Improvement to an existing snippet
  • 🐞 Bug fix
  • πŸ“– Documentation update
  • πŸ”§ Other (please describe):

Checklist

  • I have tested my code and verified it works as expected.
  • My code follows the style and contribution guidelines of this project.
  • Comments are added where necessary for clarity.
  • Documentation has been updated (if applicable).
  • There are no new warnings or errors from my changes.

Related Issues

Closes #

Additional Context

Screenshots (Optional)

Click to view screenshots

Copy link
Collaborator

@Mathys-Gasnier Mathys-Gasnier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, Thank you for your contribution.

After reviewing your PR we've found that the snippet you are adding doesn't match the scope of Quicksnip.
As it is an example instead of a snippet
Please make it so your snippet match the guidelines before further reviewing can take place

If no fix is provided within 7-10 days this PR will be closed without further notice

@Debanjan110d
Copy link
Author


Hi @Mathys-Gasnier ,

Thank you for reviewing my pull request. I've updated the snippet to better align with Quicksnip's guidelines. The revised version is now more concise, follows the snippet format, and includes a clear usage example within the snippet itself.

Here’s the updated snippet:


Title: N-Dimensional Array Creator
Description: Creates an N-dimensional NumPy array filled with a single element.
Author: Debanjan110d
Tags: numpy, arrays, python, n-dimensional

import numpy as np

def create_n_dimensional_array(n, fill_value=1):
    """Creates an N-dimensional NumPy array filled with a given value."""
    return np.full([1] * n, fill_value)

# Example usage:
arr = create_n_dimensional_array(3)
print(arr.ndim)  # Output: 3
print(arr)       # Output: [[[1]]]

I appreciate your time and feedback. Please let me know if any further refinements are needed.

Thank you!


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants