Skip to main content

Posts

Showing posts from December, 2016
Testing Python Code Testing your code is very important to know if your code is having the expected behavior. No one likes a software program which would give a weird result or a program which would break in the middle of a critical task and throw of ugly error codes. For this and many more reasons it’s very important to test you code before making it public, testing is not a “best practice” rather it’s a necessity to deliver clean and delicious code which will obey all the commands that the user provides. There are many different python modules like unittest that help you to test units of your code and then there are some tools like py.test that helps you achieve the same goal, but I want to point out a simple & fast way to quickly test your piece of code without importing any separate module other than the one that is included in your project or which you have created for testing your code. Testing code in isolation In every type of code you must first design your c
Python Tutorials If you want to download a copy of the chapter then purchase the chapter by clicking on the button below . This lesson is based on google docs so if you have any doubts on any of the topics in this lesson then you can just put a comment against that topic and I will answer that question there itself so that you don’t need to navigate to any other page or document to view the answer. Additionally you can also bug me on Quora . You can also find me on Twitter or Facebook . So, why wait go ahead and start exploring. Click on the button below to purchase the chapter
How to learn Python in short time? Many times people ask me this question How to learn Python in as short time as possible ? . I myself had this question when I was first starting out and at that time I searched and searched over internet to find a magical shortcut to learn Python, but I found none. The reality is that the “short span” of time that we want is actually relative as for some it may take a month and for some it may to 3 months or even more and that depends on individual learning capacity which is OK. It took me 2 months or so to learn the language 😄. But that’s me someone else may take more or lesser time than me. The key here is to learn by doing. You can check through the following to start learning - First start with the basics Visit the post in this blog to know about where to start so that you can get to know at least the basic concepts that can get you started with this programming language. Once you get going with the basic concepts you can pick
How Python implements “Data Encapsulation”? Data privacy or “data encapsulation” is provided by Python by default. In Python every variable or method is scoped within its parent code block. Look at the below function- def newcurrencynote(): newnote = 2000 print("This is new" + newnote + "currency note") print(newnote) print(example()) In the above function newcurrencynote() the variable newnote inside the function has “ local” scope within that function, in other words it is private to that functions only and is not accessible outside that function . So, the first print function gives an error stating that you should initialize the variable first and then print it, but since the second function is trying to access the function itself so it will print the value of the variable. If you found this post helpful and you have any suggestion to improve my blog then do post your comments below. Additionally you can also bug me on Quor