From cc0c85d64026a5e623502aa51329b8779aa8476d Mon Sep 17 00:00:00 2001 From: baphim <269010393+baphim@users.noreply.github.com> Date: Fri, 4 Sep 2026 23:04:07 -0400 Subject: [PATCH] feat(r-1.4.py): assembled completed deliverable and fixed reassignment of built in list class --- lab-01/r-1.1.py | 3 +-- lab-01/r-1.2.py | 14 ++------------ lab-01/r-1.4.py | 12 ++++++++++++ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lab-01/r-1.1.py b/lab-01/r-1.1.py index e4c8f07..b8abdf8 100644 --- a/lab-01/r-1.1.py +++ b/lab-01/r-1.1.py @@ -3,8 +3,7 @@ def is_multiple(n, m): print(True) else: print(False) - + print('Is "n" a multiple of "m"?') is_multiple(float(input('Give a value for n: ')), float(input('Give a value for m: '))) - \ No newline at end of file diff --git a/lab-01/r-1.2.py b/lab-01/r-1.2.py index a555434..f2360dc 100644 --- a/lab-01/r-1.2.py +++ b/lab-01/r-1.2.py @@ -1,19 +1,9 @@ -""" -Full disclosure, prior to attempting this, I actually looked at the link -at the top of page 51, and even visited it. I also relied heavily on w3schools -compared to the textbook. While initially learning Python, I found the language -of the book difficult, but as I grasped concepts, it came easier. I will also -be creating scratch files when needed to test ideas. They will not be submitted -with my lab submissions but will be available at my Gitea link posted with -my submitted files. -""" - def is_even(k): if k & 1 == 0: print(True) else: print(False) - + print('Is "k" an even number?') -is_even(int(input('Give a value for k: '))) \ No newline at end of file +is_even(int(input('Give a value for k: '))) diff --git a/lab-01/r-1.4.py b/lab-01/r-1.4.py index e69de29..f907a13 100644 --- a/lab-01/r-1.4.py +++ b/lab-01/r-1.4.py @@ -0,0 +1,12 @@ +def squares_sum(n): + smaller_list = [] + while n >= 2: + n = n - 1 + smaller_list.append(n) + if n == 1: + square_list = [m*m for m in smaller_list] + squares = sum(square_list) + print(squares) + + +squares_sum(int(input("Enter a positive integer: ")))