It has been a while that I wrote some code. Been learning Python using Udemy for some time. Python is truly expressive and batteries included language. I read about Hashmaps and thought I should give it a try. Within a very short duration (say 1 hour), I was kind of able to complete full hashmap implementation along with basic tests using PyTest. My coding screenshots. You can also check out my GitHub (that has Jupyter notebook file)
Showing posts with label Learning_Python. Show all posts
Showing posts with label Learning_Python. Show all posts
18 June 2019
07 January 2018
"Learning Python by Mark Lutz" - Reading Journal 6 [Chapter 10, Chapter 11 and Chapter 12]
![]() |
| Learning Python by Mark Lutz |
For next few months, I would be posting my experiences with Python more specifically the learning I am going through from the book - "Learning Python by Mark Lutz". You can find all of my reading journal of this book.
The rest of this post covers what I learned in Chapter 10, Chapter 11 and Chapter 12.
Chapter 10: Introducing Python Statements
This chapter is fairly easy to read. By now you should have written some code with statements which should make this chapter even more easier. But an important take away is "why Python is Pythonic" with to respect statements, code blocks, and indentation. Towards the end, we also see few nice and quick examples.
Chapter 11: Assignments, Expressions, and Prints
This is another great chapter that covers assignments, expressions, and prints in great detail. It details various ways of assignments, sequence unpacking, sequence assignments and augmented assignments. Variable naming rules, conventions, and expression statements are discussed too. Towards the end, there is a good section on prints and various ways of printing covering both 2.x, 3.x, and printing in version neutral way. Another great chapter.
Chapter 12: if Tests and Syntax Rules
This chapter gives an in-depth treatment of if constructs & its optional extension (elif, else) giving examples of nested and deeply nested if constructs, multiway branching. The most valuable content is the discussion on indentation and philosophy of Python with respect to code readability in the light of software maintenance. Truth values, boolean tests and if/else ternary operations are discussed. I suggest to stop here for a while and then try out examples so that the concepts are understood well.
All posts related to "Learning Python by Mark Lutz"
Friendly Note: I am posting the images and links from the publisher's website. I am not an affiliate and I do not get paid for writing this. If my journal is useful for someone to learn Python, I am more than happy :-)
Chapter 10: Introducing Python Statements
This chapter is fairly easy to read. By now you should have written some code with statements which should make this chapter even more easier. But an important take away is "why Python is Pythonic" with to respect statements, code blocks, and indentation. Towards the end, we also see few nice and quick examples.
Chapter 11: Assignments, Expressions, and Prints
This is another great chapter that covers assignments, expressions, and prints in great detail. It details various ways of assignments, sequence unpacking, sequence assignments and augmented assignments. Variable naming rules, conventions, and expression statements are discussed too. Towards the end, there is a good section on prints and various ways of printing covering both 2.x, 3.x, and printing in version neutral way. Another great chapter.
Chapter 12: if Tests and Syntax Rules
This chapter gives an in-depth treatment of if constructs & its optional extension (elif, else) giving examples of nested and deeply nested if constructs, multiway branching. The most valuable content is the discussion on indentation and philosophy of Python with respect to code readability in the light of software maintenance. Truth values, boolean tests and if/else ternary operations are discussed. I suggest to stop here for a while and then try out examples so that the concepts are understood well.
All posts related to "Learning Python by Mark Lutz"
Friendly Note: I am posting the images and links from the publisher's website. I am not an affiliate and I do not get paid for writing this. If my journal is useful for someone to learn Python, I am more than happy :-)
05 January 2018
"Learning Python by Mark Lutz" - Reading Journal 5 [Chapter 8 and Chapter 9]
![]() |
| Learning Python by Mark Lutz |
For next few months, I would be posting my experiences with Python more specifically the learning I am going through from the book - "Learning Python by Mark Lutz". You can find all of my reading journal of this book.
The rest of this post covers what I learned in Chapter 8 and Chapter 9.
Chapter 8: List and Dictionaries
This chapter has given a lot of information in lists and directories. The key thing is that each operation is shown with examples. If you have gone through the chapter on "string", the list should be similar and you can just zip it through. The operations such as create, modify, slice, sequencing, iteration, comprehension and in place modification with loads of examples. Once you are through this chapter, you will understand (and relate to) if someone says you need not memorize things in Python. It was a very good read.
Chapter 9: Tuples, Files, and Everything Else
This chapter gives a nice exposition on tuples, named tuples, files and overview/summary of types that are discussed so far. At this point in time, I have to admit that Python is becoming easier to comprehend. Since we have seen lists/dictionary already, tuples and named tuples are similar except that they are immutable. With respect to files, I learned how to read, write, seek and flush the buffers, iterate over lines, opening them in the binary mode which turns off encoding/decoding Unicode, introduction to pickle, JSON & struct and file context manager. The chapter closes with a lengthy overview of types giving us a treat.
With this, I have completed Part 2 of the book roughly 20% of the book. Still, I have 80% to cover but it is exciting :-). Overall, my impression is - part 2 is deeper and insightful than part1 (with no offense meant to part1)
All posts related to "Learning Python by Mark Lutz"
Friendly Note: I am posting the images and links from the publisher's website. I am not an affiliate and I do not get paid for writing this. If my journal is useful for someone to learn Python, I am more than happy :-)
Chapter 8: List and Dictionaries
This chapter has given a lot of information in lists and directories. The key thing is that each operation is shown with examples. If you have gone through the chapter on "string", the list should be similar and you can just zip it through. The operations such as create, modify, slice, sequencing, iteration, comprehension and in place modification with loads of examples. Once you are through this chapter, you will understand (and relate to) if someone says you need not memorize things in Python. It was a very good read.
Chapter 9: Tuples, Files, and Everything Else
This chapter gives a nice exposition on tuples, named tuples, files and overview/summary of types that are discussed so far. At this point in time, I have to admit that Python is becoming easier to comprehend. Since we have seen lists/dictionary already, tuples and named tuples are similar except that they are immutable. With respect to files, I learned how to read, write, seek and flush the buffers, iterate over lines, opening them in the binary mode which turns off encoding/decoding Unicode, introduction to pickle, JSON & struct and file context manager. The chapter closes with a lengthy overview of types giving us a treat.
With this, I have completed Part 2 of the book roughly 20% of the book. Still, I have 80% to cover but it is exciting :-). Overall, my impression is - part 2 is deeper and insightful than part1 (with no offense meant to part1)
All posts related to "Learning Python by Mark Lutz"
Friendly Note: I am posting the images and links from the publisher's website. I am not an affiliate and I do not get paid for writing this. If my journal is useful for someone to learn Python, I am more than happy :-)
04 January 2018
"Learning Python by Mark Lutz" - Reading Journal 4 [Chapter 6 and Chapter 7]
![]() |
| Learning Python by Mark Lutz |
For next few months, I would be posting my experiences with Python more specifically the learning I am going through from the book - "Learning Python by Mark Lutz". You can find all of my reading journal of this book.
The rest of this post covers what I learned in Chapter 6 and Chapter 7.
Chapter 6: The Dynamic Typing Interlude
This chapter provides an excellent coverage of dynamic types, objects, variables and a picture on how the objects are created in memory. Dynamic typing - how Python detects the type (or rather where it stores the type of the object), the significance of variable names, object reference counts and where the variable names are stored are discussed. A brief walkthrough on automatic reclaim of memory (aka Garbage Collection) and GC in the context of shared references, shared references and In-place changes and shared references and equality are discussed. If you are from the language like Java, you should be knowing most of the concepts already. Overall a nice theoretical view of PVM memory and object space. Nice and neat chapter
Chapter 7: String Fundamentals
If you like strings and string manipulation - I bet you will like this chapter. What appears as simple (when we do no know) becomes quite overwhleming when we go deeper. This chapter is written in such a way that it never overwhelms with a lot of friendly advices. Do not miss this chapter if you are a fan of strings. Let us come what I learned. String, why string is a sequence, string liternals, escape sequences, raw strings, unicode representation, how to express strings (three different ways), indexing, slicing, extended slicing, conversion, changing strings, immutablity, string methods, string module (which you should be using), formatting expressions. After reading the chapter, I feel that this is one of the chapters that I should read few times. I am sure that strings will take some time to master. Overall, the chapter is nice, informative. Kudos to the author again.
All posts related to "Learning Python by Mark Lutz"
Friendly Note: I am posting the images and links from the publisher's website. I am not an affiliate and I do not get paid for writing this. If my journal is useful for someone to learn Python, I am more than happy :-)
Chapter 6: The Dynamic Typing Interlude
This chapter provides an excellent coverage of dynamic types, objects, variables and a picture on how the objects are created in memory. Dynamic typing - how Python detects the type (or rather where it stores the type of the object), the significance of variable names, object reference counts and where the variable names are stored are discussed. A brief walkthrough on automatic reclaim of memory (aka Garbage Collection) and GC in the context of shared references, shared references and In-place changes and shared references and equality are discussed. If you are from the language like Java, you should be knowing most of the concepts already. Overall a nice theoretical view of PVM memory and object space. Nice and neat chapter
Chapter 7: String Fundamentals
If you like strings and string manipulation - I bet you will like this chapter. What appears as simple (when we do no know) becomes quite overwhleming when we go deeper. This chapter is written in such a way that it never overwhelms with a lot of friendly advices. Do not miss this chapter if you are a fan of strings. Let us come what I learned. String, why string is a sequence, string liternals, escape sequences, raw strings, unicode representation, how to express strings (three different ways), indexing, slicing, extended slicing, conversion, changing strings, immutablity, string methods, string module (which you should be using), formatting expressions. After reading the chapter, I feel that this is one of the chapters that I should read few times. I am sure that strings will take some time to master. Overall, the chapter is nice, informative. Kudos to the author again.
All posts related to "Learning Python by Mark Lutz"
Friendly Note: I am posting the images and links from the publisher's website. I am not an affiliate and I do not get paid for writing this. If my journal is useful for someone to learn Python, I am more than happy :-)
01 January 2018
"Learning Python by Mark Lutz" - Reading Journal 3 [Chapter 4 and Chapter 5]
![]() |
| Learning Python by Mark Lutz |
For next few months, I would be posting my experiences with Python more specifically the learning I am going through from the book - "Learning Python by Mark Lutz". You can find all of my reading journal of this book
The rest of this post covers what I learned in Chapter 4 and Chapter 5.
Chapter 4: Introducing Python Object Types
As the chapter title says, this chapter introduces core data types that are built-in to Python - Numeric, String, Lists, Dictionaries. It also gives an overview of Files, Set, and user-defined classes. It talks about sequences, mappings, and sets. How to iterate over collections and access mappings/dictionaries. What are type-specific functions available. On files, a simple read/write with encoding/decoding is discussed at a higher level. At the end of this chapter, you will realize that everything is object in Python (and dynamic/strick typing system). It was very interesting to read. On the downside, I am still curious as to when I will write some code. I do not see coding exercises/puzzles at the end of the chapter yet.
Chapter 5: Numeric Types
What we think as just integers and floats are mind-boggling when we try to go little deeper. This chapter is no exception especially when you have two versions of Python (2.x and 3.x) behave little differently. I am pretty sure that numeric types and differences in two major versions of Python are going to be little tough to remember and one has to keep referring the material until it becomes second nature. Let us come to the learning.
This chapter covers numeric types - integers, floats, decimal, fraction, complex numbers, operators, building expressions, precedence, bitwise operators, comprehension, sets, booleans, evaluation of tests, chained tests, representing numbers in other bases (hex, octal and binary) and finally some introduction on number crunching with popular modules. I strongly suggest practicing while you read to get the feel of what the author says. The chapter was longer with so many details but never boring though. Truly great stuff.
All posts related to "Learning Python by Mark Lutz"
Friendly Note: I am posting the images and links from the publisher's website. I am not an affiliate and I do not get paid for writing this. If my journal is useful for someone to learn Python, I am more than happy :-)
Chapter 4: Introducing Python Object Types
As the chapter title says, this chapter introduces core data types that are built-in to Python - Numeric, String, Lists, Dictionaries. It also gives an overview of Files, Set, and user-defined classes. It talks about sequences, mappings, and sets. How to iterate over collections and access mappings/dictionaries. What are type-specific functions available. On files, a simple read/write with encoding/decoding is discussed at a higher level. At the end of this chapter, you will realize that everything is object in Python (and dynamic/strick typing system). It was very interesting to read. On the downside, I am still curious as to when I will write some code. I do not see coding exercises/puzzles at the end of the chapter yet.
Chapter 5: Numeric Types
What we think as just integers and floats are mind-boggling when we try to go little deeper. This chapter is no exception especially when you have two versions of Python (2.x and 3.x) behave little differently. I am pretty sure that numeric types and differences in two major versions of Python are going to be little tough to remember and one has to keep referring the material until it becomes second nature. Let us come to the learning.
This chapter covers numeric types - integers, floats, decimal, fraction, complex numbers, operators, building expressions, precedence, bitwise operators, comprehension, sets, booleans, evaluation of tests, chained tests, representing numbers in other bases (hex, octal and binary) and finally some introduction on number crunching with popular modules. I strongly suggest practicing while you read to get the feel of what the author says. The chapter was longer with so many details but never boring though. Truly great stuff.
All posts related to "Learning Python by Mark Lutz"
Friendly Note: I am posting the images and links from the publisher's website. I am not an affiliate and I do not get paid for writing this. If my journal is useful for someone to learn Python, I am more than happy :-)
31 December 2017
"Learning Python by Mark Lutz" - Reading Journal 2 [Chapter 2 and Chapter 3]
![]() |
| Learning Python by Mark Lutz |
For next few months, I would be posting my experiences with Python more specifically the learning I am going through from the book - "Learning Python by Mark Lutz". You can find all of my reading journal of this book and accompanying code in GitHub
The rest of this post covers what I learned in Chapter 2 and Chapter 3.
Chapter 2: How Python Runs Programs
This chapter introduces you a needed theoretical overview of Python runtime (interpreter) and Python bytecode. The execution of the program is explained in two viewpoints - programmer's view and Python's view. The programmers' view is what code to be written following the language constructs generating source code and Python's view is how to execute the program converting source code to actual functionality (the output of programmer view is input to Python's view). The chapter offers execution model variations (different runtime models - CPython, Jython, Stackless, PyPy) and optimization tools (Psyco JIT, Shed Skin, Cthyon). This chapter is wonderfully written and there will be some learning to everyone. I thoroughly enjoyed the content :-). Kudos to the author for covering a variety of insights.
Chapter 3: How You Run Programs
I need to start with a warning. This chapter has so much information and ways to run your code like "from the command line", "interactive", "IDLE" and "IDE". I personally suggest that we should try all the methods at least once and choose one of the methods. I find IDE convenient. Yes, I do use PyCharm community edition. On the good side, the chapter introduces modules, importing, namespaces, module reloads which is quite interesting. Good round up of exercises at the end. I do not want to bog you down with a lot of details. One little advice I have for you is to take breaks while reading this chapter and be prepared for a long haul. Without the break, I feel this chapter is little tough to complete and might appear daunting (and might be demotivating to complete). The good thing about such details are completeness
BTW, with this, we complete the first part of the book and we have eight more parts.
Looking forward to the Part 2
All posts related to "Learning Python by Mark Lutz"
Source Code@GitHub (exercises of this book)
Friendly Note: I am posting the images and links from the publisher's website. I am not an affiliate and I do not get paid for writing this. If my journal is useful for someone to learn Python, I am more than happy :-)
Chapter 2: How Python Runs Programs
This chapter introduces you a needed theoretical overview of Python runtime (interpreter) and Python bytecode. The execution of the program is explained in two viewpoints - programmer's view and Python's view. The programmers' view is what code to be written following the language constructs generating source code and Python's view is how to execute the program converting source code to actual functionality (the output of programmer view is input to Python's view). The chapter offers execution model variations (different runtime models - CPython, Jython, Stackless, PyPy) and optimization tools (Psyco JIT, Shed Skin, Cthyon). This chapter is wonderfully written and there will be some learning to everyone. I thoroughly enjoyed the content :-). Kudos to the author for covering a variety of insights.
Chapter 3: How You Run Programs
I need to start with a warning. This chapter has so much information and ways to run your code like "from the command line", "interactive", "IDLE" and "IDE". I personally suggest that we should try all the methods at least once and choose one of the methods. I find IDE convenient. Yes, I do use PyCharm community edition. On the good side, the chapter introduces modules, importing, namespaces, module reloads which is quite interesting. Good round up of exercises at the end. I do not want to bog you down with a lot of details. One little advice I have for you is to take breaks while reading this chapter and be prepared for a long haul. Without the break, I feel this chapter is little tough to complete and might appear daunting (and might be demotivating to complete). The good thing about such details are completeness
BTW, with this, we complete the first part of the book and we have eight more parts.
Looking forward to the Part 2
All posts related to "Learning Python by Mark Lutz"
Source Code@GitHub (exercises of this book)
Friendly Note: I am posting the images and links from the publisher's website. I am not an affiliate and I do not get paid for writing this. If my journal is useful for someone to learn Python, I am more than happy :-)
30 December 2017
"Learning Python by Mark Lutz" - Reading Journal 1 [Intro and Chapter 1]
For next several months, I would be posting my experiences with Python more specifically the learning I am going to have from the book - "Learning Python by Mark Lutz". My first impression after reading the table of contents is very promising. It looks to me that it is one of the books that provide complete coverage of Python and exhaustive too. I am eager and yet at the same time little afraid because I never learned any programming language reading a book completely. Since it is massive in size containing 1500+ pages, I feel it is going to test my consistency. And that is one of the reasons why I want to write my reading journal.
The rest of the post contains what I learned from the chapter 1 (Initially I thought I would write journal of first three chapters. But I could not do it due to merits and the amount of content in this chapter)Chapter 1: A Python Q & A Session
The book starts with a bang providing enough material and motivation as to why someone should invest time learning Python and reading/working-out this book. This chapter provides an introduction to Python in the form of question and answer. These are kind of questions that were eating my mind and wanting an answer because the websites or courses talk only on the language but this book seems to address the gap as to "why". I also feel that the author has set up an important tone - question everything when you learn. You will find answers to the following questions
- Why people use Python?
- Is Python scripting language?
- Is there any downside of Python?
- Who uses Python?
- What can I do with Python
- How is Python developed and supported?
- What are its technical strengths?
- How Python stacks up to other languages?
This chapter gives deeper insights with solid reasonings and you will understand what you will get by learning Python and what is the amount of knowledge that you will get by reading this book - "Learning Python by Mark Lutz"
Needless to say, I am all excited to continue to learn Python :-)
Subscribe to:
Posts (Atom)