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

 

gaurav1780@gmail.com 04_lists > patterned_list
prev  |  next  |  chance

First, solve https://codingbat.com/prob/p216283 Define a function that when passed three integers (say a, b, n), returns a list in an arithmetic progression such that it contains n items, the first (if any) being a, the second (if any) being b. The subsequent items can be worked out from the information provided. Return an empty list if n <= 0.


patterned_list(1, 2, 0) → []
patterned_list(1, 2, -1) → []
patterned_list(2, 4, 5) → [2, 4, 6, 8, 10]

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

def patterned_list(a, b, 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: 4 Post-solution available

Copyright Nick Parlante 2017 - privacy