From 08dfe23287eab4cdd7372af6c3989d0a1a8ffe10 Mon Sep 17 00:00:00 2001 From: AngelSmith2 Date: Fri, 6 Oct 2017 13:57:59 +0000 Subject: [PATCH] challenge --- cs-python-loops-challenge.ipynb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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", " " ]