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

Choice Function: Replaced sample with choice for selecting a single code #154

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Soyvor
Copy link

@Soyvor Soyvor commented Apr 11, 2024

…andom item from a sequence. This simplifies the code when only one random choice is needed.

Pen State Functions: Corrected the function names from pu and pd to penup and pendown, respectively, for clarity and consistency.

Position Copy: Used the copy() method to create a copy of the position vector before modifying it. This prevents unintended changes to the original position vector.

Distance Calculation: Replaced abs(tt.pos() - start_position) with tt.distance(start_position) to calculate the distance between two points more accurately.

Indentation and Formatting: Ensured consistent indentation and formatting throughout the code for readability and maintainability.

Soyvor added 3 commits April 11, 2024 22:00
…andom item from a sequence. This simplifies the code when only one random choice is needed.

Pen State Functions: Corrected the function names from pu and pd to penup and pendown, respectively, for clarity and consistency.

Position Copy: Used the copy() method to create a copy of the position vector before modifying it. This prevents unintended changes to the original position vector.

Distance Calculation: Replaced abs(tt.pos() - start_position) with tt.distance(start_position) to calculate the distance between two points more accurately.

Indentation and Formatting: Ensured consistent indentation and formatting throughout the code for readability and maintainability.
Naming Conventions: Renamed private methods to follow Python's naming conventions (snake_case).

Returning None: Changed the return value of peek and pop methods to None instead of False for clarity. In Python, None is typically used to indicate the absence of a value.

Use of Dummy Element: Initialized the heap with a dummy element at index 0 to simplify index calculations. This helps in avoiding special cases in the code.

Output Formatting: Changed the output printing to exclude the dummy element when printing the heap elements.
@Soyvor Soyvor changed the title Choice Function: Replaced sample with choice for selecting a single r… Choice Function: Replaced sample with choice for selecting a single code Apr 16, 2024
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.

1 participant