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

 

triple_minus_one


A sequence of values starts with 1. Each term is found by tripling the last term and subtracting 1. Write a function that generates the nth term in the sequence. The first four terms are 1, 5, 14, 41, so if asked for the fourth term the function would return 41.


triple_minus_one(2) → 5
triple_minus_one(3) → 14
triple_minus_one(4) → 41

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

def triple_minus_one(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

Post-solution available

Copyright Nick Parlante 2017 - privacy