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

 

konstans@stuy.edu all > sumOfFirstNSquares
prev  |  next  |  chance

Find the sum of the first n perfect squares when n is negative, return 0. e.g. sumOfFirstNSquares(3) is 1 + 4 + 9 which is 14


sumOfFirstNSquares(1) → 1
sumOfFirstNSquares(2) → 5
sumOfFirstNSquares(3) → 14

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

def sumOfFirstNSquares(n):

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: 5

Copyright Nick Parlante 2017 - privacy