Add python files

This commit is contained in:
lolabird 2023-10-19 14:52:00 -06:00
commit 27b5664ae7
7 changed files with 271 additions and 0 deletions

View file

@ -0,0 +1,16 @@
# Runestone.Academy thinkcspy course
# Chapter 10
# Problem 14
def replace(s, old, new):
# your code here
newStr = s.split(old)
newStr = new.join(newStr)
return newStr
s = 'I love spom! Spom is my favorite food. Spom, spom, spom, yum!'
print(replace('Mississippi', 'i', 'I'))
print(replace(s, 'om', 'am'))
print(replace(s, 'o', 'a'))