From ee9b99e138bce8665627bbcc630340ee3bf5b8d9 Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Mon, 3 Mar 2025 17:07:02 +0000 Subject: [PATCH] Completed Exercise 10-1 Learning Python --- Chapter_10/10-01_learning_python.py | 15 +++++++++++++++ Chapter_10/learning_python.txt | 4 ++++ 2 files changed, 19 insertions(+) create mode 100644 Chapter_10/10-01_learning_python.py create mode 100644 Chapter_10/learning_python.txt diff --git a/Chapter_10/10-01_learning_python.py b/Chapter_10/10-01_learning_python.py new file mode 100644 index 0000000..48b3dea --- /dev/null +++ b/Chapter_10/10-01_learning_python.py @@ -0,0 +1,15 @@ +# Exercise 10-1 Learning Python +# Learning Objective: Read from 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) + diff --git a/Chapter_10/learning_python.txt b/Chapter_10/learning_python.txt new file mode 100644 index 0000000..dac5c3c --- /dev/null +++ b/Chapter_10/learning_python.txt @@ -0,0 +1,4 @@ +In Python you can assign variables +In Python you can do math +In Python you can create loops +In Python you can use if statements \ No newline at end of file