diff --git a/cs-python-loops-challenge.ipynb b/cs-python-loops-challenge.ipynb index ed55ae9..9205338 100644 --- a/cs-python-loops-challenge.ipynb +++ b/cs-python-loops-challenge.ipynb @@ -116,9 +116,9 @@ "source": [ "def squaresTo(num):\n", " squares = 0\n", - " #add your code with the required loop here\n", - " \n", - "\n", + " for i in range(1,num+1):\n", + " squares+=i**2\n", + " # print(squares,i)\n", " return squares" ] }, @@ -157,9 +157,8 @@ "source": [ "def sumOfFactors(factor, num):\n", " sumF=0\n", - " # add the loop here\n", - " \n", - " \n", + " for i in range(1,num+1):\n", + " sumF+=i+factor \n", " return sumF" ] }, @@ -197,9 +196,8 @@ "source": [ "def sumOfMultiplesOfTwoFactors(f1,f2,num):\n", " sum2F = 0\n", - " #add your code with loop here\n", - " \n", - "\n", + " for i in range(1,num+1):\n", + " sum2F+=i+f1+f2\n", " return sum2F\n", " " ]