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

 

gaurav1780@gmail.com 06_strings > pattern
prev  |  next  |  chance

Define a function that when passed a character (say, ch) and an integer (say, n), returns a String containing the character occurring 1 to n times, each time separated by a dot. Examples: ch = '*', n=3 -> return "*.**.***" ch='$', n=4 -> return "$.$$.$$$.$$$$"


pattern('*', 3) → '*.**.***'
pattern('$', 4) → '$.$$.$$$.$$$$'
pattern('5', 2) → '5.55'

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

def pattern(ch, 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: 2 Post-solution available

Copyright Nick Parlante 2017 - privacy