Fall 2024 - P1
Big Idea 3 | .1 | .2 | .3 | .4 | .5 | .6 | .7 | .8 | .10 |
3.4 String Operations
3.4 Team Teach String Operations
Joining Strings
- Basically opposite of splitting strings
- .join() in Python and JS
print(",".join(['Darryl', 'Mico', 'Fang']))
apple,banana,grape
%%js
console.log(['Darryl', 'Mico', 'Fang'].join(","));
<IPython.core.display.Javascript object>
- Use Case: Combine a list of strings into a single string, helpful for reformatting content