Development > Coding

Beginning with Python

<< < (6/6)

bitsnpcs:
I noticed in July 2017 the follow on book called - "Learn More Python the Hard Way - Zed Shaw" comes out, it is now available on Amazon pre-order, with a small discount of the price.


bitsnpcs:
Hello,

for those using the book "Learn Python the Hard Way" I have found an error in the book.

Page 253 - Exercise 5 - Command Line Crash Course

Line 30 reads

cd ../../ ..

It needs to read

cd ../ ../ ../

I had tried the exercise 3 or 4 times and got an error in the terminal each time, eventually I cd back to home and began further on in the exercise, and where the cd ../ is used later to move up 7 levels with no error, after completing the exercise I then tried the line 30 adding the final / like is in the later part of the exercise, this command then didn't give an error.
I redone the entire exercise with that added to line 30 and there were no errors produced in the terminal.

So I think he has made a mistake, that you will need to add in the book a / to the end of line 30 to complete the exercise.

I am using the Third Edition.

If you found any errors when using the book, or find any errors as you work through the book please can you also add them in the thread to help each other.

bitsnpcs:
I finished these 15 exercise now, other than the self learning in exercise 15 which I will use The Linux Command Line book for, 3 are covered in Chapter 9 and the first is covered in Chapter 17, being only on Chapter 4 its a long way off for me.

I didn't find any other errors as such.
But... exercise 13 -
he says to create a test2.txt then cat it, he does not say to type that contents in to the file so it will produce zero results, and will waste your time.
Better to cat test.txt to see the lines from previous exercise, he writes after exercise 13 in the "You learned this", also to cat test.txt and see the output from last exercise, it was the only way I managed to understand wtf he was on about.
Hopefully it will save someone not to waste their time also on exercise 13, and to read after the exercise ,what you have learned, before learning it, then you will actually be able to learn it etc.

The printed url for the Bash Cheat Sheet under title Unix Bash References is incorrect it has cli at the start of the url and this goes to the sales page not the free pdf.
This is the correct url


I am hoping the Python chapters are of a better quality.

Update -
They are.
I have completed the Python exercise 0, 1, 2, and began 3, (before my available time ran out), his style of writing in the Python Chapters is very different to the command line course. It's extremely easy to follow and learn from. 8) (even for me)

bitsnpcs:
I noticed a lot of people (and me too) have trouble with this one initially, so I decided to add it here to save people time so they can understand it sooner and continue the learning rather than get hung up on more advanced details if searching about it.

% - Modulus explained -

100-25*3%4
answer 97

Why -
25*3%4
25*3=75
75%4
answer 3

How it works -
75 divided into 4= 18 times
18x4=72
75-72= r3
%=3

Actual calculation at the final stage is -
100-3
so it is why the answer was 97


First of the ex3 explained

3+2+1-5+4%2-1/4+6

3+2+1=6
6-5=1
4%2=0  (4 divided into 2=2, zero remains, modulus %=0)
1+0=1
1/4=0 (1 cannot divide into 4 using whole numbers)
1-0=1
1+6=7
so it is why the answer was 7

I used Python calculating to work it out.
Just open python in terminal then trial error the various breakdowns until I understood what was happening.
Which was part of the #2 extra practices, so it also means can multi-task and 2 things at same time, if trying this.

I hope it helps someone else learning if they get stuck on modulus.

Navigation

[0] Message Index

[*] Previous page

Go to full version