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

 

konstans@stuy.edu > kthEven
prev  |  next  |  chance

Find the Kth positive even number, where 0th is 0, 1st is 2, etc. Do this recursively, think how can you express the Kth even number in terms of a smaller even number? This is very obviously 2*k, but the goal is to do it recursively!


kthEven(0) → 0
kthEven(1) → 2
kthEven(2) → 4

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

def kthEven(k):

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

Copyright Nick Parlante 2017 - privacy