Learn Python 3 The Hard Way
The project is created for learning Python 3 based on Learn Python The Hard Way
by Zed A. Shaw.
Why I create this project?
Mainly for learning purpose. I will also write note for every exercise (if it is needed) in this README.
Getting Started
Prerequisites
You need to have
Installation
- Clone this project (Using
git
command:git clone https://github.com/vietdang7/LPTHW.git
or through your GitDesktop application) - Install Python 3
- Install Atom
Testing
In your terminal:
- Move or
cd
toLPTHW
(where you've just cloned the project) - Move or
cd
to the exercise folder that you wanted - Run
python3 file_name.py
. For example:python3 ex1.py
Please note: all exercise files are in "Exercises" folder.
Exercise notes:
- Exercise 1:
- To print new line, we can use
print("\n")
- In Python3,
print
is now a function
- To print new line, we can use
- Exercise 2:
- Use # for commenting in Python
- Read code backward to check errors manually
- Exercise 3:
- Use math symbols and print in the same line with a string (seperate by a ",")
- "%" is a modulus
- Exercise 4:
- There will be space between string and variable when use print().
For example:
print("There are",cars,"cars available.")
-> There are 100 cars available. To avoid space, we can use concatenation+
orprint 'Value is "%d"' % value
- There will be space between string and variable when use print().
For example:
- Exercise 5:
- To format string and add variables inside, we will need to user
print(f"string {variableName}")
- To format string and add variables inside, we will need to user
Contribution
If you want to make contribution for this project, feel free to fork
this project and make pull request
.
I grealty appreciate for your contribution.
License
- Copyright of
Learn Python The Hard Way
is belong to Zed A. Shaw. - This project is licensed under the MIT license