munch2024 / munch

2 stars 11 forks source link

Fixes #88 #89

Closed Dhooly closed 8 months ago

Dhooly commented 8 months ago

I've added documentation to the python program in Issue #88

As you will see in the code snippet provided, ChatGPT genereated documentation/comments for the Pythagorean triple program. It explains the algorithm for each line in program.

ChatGPT Link

Code Snippet:

# This code generates Pythagorean triples (a, b, c) where 'c' is the hypotenuse,
# with all sides ranging from 1 to 20.

# Loop over possible values for the hypotenuse 'c' from 1 to 20.
for c in range(1, 21):
    # Loop over possible values for side 'b' from 1 to 'c' exclusive.
    for b in range(1, c):
        # Loop over possible values for side 'a' from 1 to 'b' exclusive.
        for a in range(1, b):
            # Check if the current values of 'a', 'b', and 'c' form a Pythagorean triple.
            if a**2 + b**2 == c**2:
                # If the condition is met, print the Pythagorean triple.
                print(f'{a} {b} {c}')