Files
cybr108/lab-01/r-1.4_scratch.py
T
2026-09-04 22:35:22 -04:00

25 lines
559 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 4 21:18:16 2026
@author: joseph
Write a short Python function that takes a positive integer n and returns the
sum of the squares of all the positive integers smaller than n.
"""
def squares_sum(n):
list = []
while n >= 2:
n = n - 1
list.append(n)
if n == 1:
square_list = []
for val in list:
square_list.append(val*val)
print(square_list)
squares_sum(5)