I have passed the Python Essentials 1 course and have earned the badge. Feel free to check it out here https://www.credly.com/badges/4e046c1b-f284-4f2d-a2cd-e1701f52a2b1/public_url
Author: admin
Post #54 (Python Programming) – Print debugging
Sometimes it is not possible for you to use a debugger. It may not be available, this is highly unlikely. So what do you do in this case? You can use print debugging. Print debugging is essentially using the print function to print portions of your code as it runs that way you can watch…
Post #53 (Python Programming) – Errors playing hard to get
As I’ve mentioned in some of my previous posts python is an interpreted language, meaning it’s parsed as it is being executed. This can lead to an interesting issue, look at the following code. Ex: Temp = int(input(“Enter the temperature in celsius: “)) if Temp <= 0: print(“Might want to wear a coat”) else: prin(“At…
Post #52 (Python Programming) – Different exceptions and testing your code
There are more exceptions than just ZeroDivisionError and ValueError. There are several exceptions to choose from but I would like to discuss three that are useful to know about. These are AttributeError, TypeError, and of course the dreaded SyntaxError. TypeError can be induced when your code receives an invalid value for its argument. Here’s an…
Post #51 (Python Programming) – Multiple exceptions and the default exception
In one of my previous posts I brought up the idea of using try and except within python to handle errors but what if you want different responses for different errors? Well you’re in luck, you can have multiple exceptions for different errors and even have a default exception. This default exception must always be…
Post #50 (Informational) – Happy 50th post! Also a few changes
I have been uploading to this site for just over a year now posting what I’m learning about along to way to share my knowledge with the community. I believe these posts may be difficult to review in retrospect and will make it harder for someone who is on this journey. I will continue to…
Post #49 (Python Programming) – Errors within your code and how to react
If you’re reading this you’ve probably seen errors in your code before, here’s the question what do you? Here is am example of code that will return an error Ex: var = int(input(“Enter an integer here: “)) print(var) Result: Enter an integer here: No Traceback (most recent call last): File “main.py”, line 1, in var…
Post #48 (Python Programming) – The use of tuples within Dictionaries
I’ve mentioned how tuples can be used within dictionaries in a previous post but I thought I would take the time just to show what that would look like, this will be a quick one. Ex: Dictionary = {Variable: 5, Float: 5.5, list: [1,2,3,4,5], tuple:1,} print(Dictionary[tuple]) Result: 1,
Post #47 (Python Programming) – Methods used by dictionaries and list mutability
There are two methods I’d like to talk about today, keys(), items(), and values. Dictionaries are not sequential, which essentially means you cannot iterate through them with a for loop. This is where these methods come in, but why tell you when I can show you. Ex: Dictionary = {1: “One”, 2: “Two”, 3: “Three”}…
Post #46 (Python Programming) – Dictionaries within Python
Today I will be talking about dictionaries in python. Dictionaries use a key-value pair. For example I need the phone number of my friend Bob, I look up the name Bob and there’s his number. This is a good example of what dictionaries are used for but what do they look like? Ex: Dictionary =…