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

Python > Warmup-1 > front3
prev  |  next  |  chance

Given a string, we'll say that the front is the first 3 chars of the string. If the string length is less than 3, the front is whatever is there. Return a new string which is 3 copies of the front.

front3('Java') → 'JavJavJav'
front3('Chocolate') → 'ChoChoCho'
front3('abc') → 'abcabcabc'

...Save, Compile, Run         

See also Python Example Code. Python help docs: Python Strings | Python Lists | Python If Boolean


prev  |  next  |  chance   |  CodingBat  >  Warmup-1

Forget It! -- delete my code for this problem 136.0

Copyright Nick Parlante 2006-10 - privacy