From 03d91eeb6efda994fee0a485083af7e2355e56ca Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Mon, 3 Mar 2025 17:11:07 +0000 Subject: [PATCH] Completed 10-2 Learning C --- Chapter_10/10-02_learning_c.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Chapter_10/10-02_learning_c.py diff --git a/Chapter_10/10-02_learning_c.py b/Chapter_10/10-02_learning_c.py new file mode 100644 index 0000000..2fdeb5a --- /dev/null +++ b/Chapter_10/10-02_learning_c.py @@ -0,0 +1,15 @@ +# Exercise 10-2 Learning C +# Learning Objective: Replace words in a text file + +from pathlib import Path + +path = Path('Chapter_10/learning_python.txt') +contents = path.read_text() + +#print(contents) + +lines = contents.splitlines() + +for line in lines: + print(line.replace('Python', 'C')) +