id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

peter@norvig.com > sum_squares2
prev  |  next  |  chance

Given a list of numbers, compute the sum of the squares of the numbers. You had this problem before, but this time, you aren't allowed to use "for" or "range". Use "while" instead. (The idea is that you get more of a feel for what the computer is doing, step by step.)


sum_squares2([1, 2, 3, 4]) → 30
sum_squares2([100, 200, 300, 400]) → 300000
sum_squares2([]) → 0

...Save, Compile, Run (ctrl-enter)

def sum_squares2(nums):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 171 Post-solution available

Copyright Nick Parlante 2017 - privacy