-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chapter 6 - Test File #1
Comments
Yes, I can also confirm this. I think the method the python script uses disregards some bytes. I double checked using the Linux's wc command |
I just saw in the book the solution is correct on page 111, when it uses the linux's wc command it has the 714 total, but the
We can see that the len of the file's string isn't the same as a byte size.
source: https://stackoverflow.com/questions/4967580/how-to-get-the-size-of-a-string-in-python |
Well, first off, my apologies for taking so long to address the original bug @safeisrisky. Yes, I can see there is a discrepancy between how I'm counting bytes using the length of a string and the actual size of the string. At this point, I can't fix the book, so I think it will just have to remain "wrong" where here "wrong" means "not the same as wc." It's unfortunate, but the point of the exercise is to get the reader to think about lines, words, and characters. I hate that I missed the distinction between characters and memory! Thanks for pointing this out. |
Hi!
With this change, there should be a change in the Also, thank you @kyclark for all the work you did on this book. I'm really enjoying it. |
Fixes kyclark#1 Use map function when assigning low, high in read_csv to split the string at the '-' character, and convert the strings to integers using int() function, the first map argument. Fixes kyclark#2 Initiate empty list as wod. Use a foor loop of random.sample(exercises, ...) which creates a list of tuples. Assign 3 variables for each iteration of the loop: exercise, low, and high. Pick a random number between low and high, and append the tuple to wod. If the easy flag is given as argument, divide reps by two. Use the int() function to convert the result to an integer.
Hi,
I think there is a bug in the test file for Chapter 6 -
tiny_python_projects/06_wc/test.py/
The following is a test function
I think the above test function should have been
The text was updated successfully, but these errors were encountered: