Completed Exercise 10-1 Learning Python
This commit is contained in:
parent
b4835be881
commit
ee9b99e138
15
Chapter_10/10-01_learning_python.py
Normal file
15
Chapter_10/10-01_learning_python.py
Normal file
@ -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)
|
||||
|
||||
4
Chapter_10/learning_python.txt
Normal file
4
Chapter_10/learning_python.txt
Normal file
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user