<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Abraham Gumba</title>
    <description>The latest articles on Forem by Abraham Gumba (@owentechke).</description>
    <link>https://forem.com/owentechke</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F970185%2F3ca37f6e-1d44-4128-b533-a2b6565a026c.jpeg</url>
      <title>Forem: Abraham Gumba</title>
      <link>https://forem.com/owentechke</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/owentechke"/>
    <language>en</language>
    <item>
      <title>Can I Earn Money After Learning Python?</title>
      <dc:creator>Abraham Gumba</dc:creator>
      <pubDate>Mon, 14 Aug 2023 17:02:12 +0000</pubDate>
      <link>https://forem.com/owentechke/can-i-earn-money-after-learning-python-5gca</link>
      <guid>https://forem.com/owentechke/can-i-earn-money-after-learning-python-5gca</guid>
      <description>&lt;h2&gt;
  
  
  The Question
&lt;/h2&gt;

&lt;p&gt;Another common question that beginner programmers ask is a variation of "Can I earn money after learning [insert programming language]?" Sometimes it is phrased along the lines of "What do I need to learn to become a developer?"&lt;/p&gt;

&lt;h2&gt;
  
  
  How To Get The Answer
&lt;/h2&gt;

&lt;p&gt;The obvious way to answer this question is to look at what the employers actually publish. You can find this in job ads. So look at job ads wherever you hope to get a job, whether in the area where you live or online. Look at several of them so that you can start noticing the commonly asked for skills and requirements. Also look at requirements from other places, so that you can see if there are possible emerging trends that may not yet be in your area.&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;p&gt;If you come across a requirement that is frequently asked for and you do not have it, at least familiarise yourself with it, or if possible, learn it to a point where you can use it to an extent. You can consider incorporating some of these technologies into your projects, so you can legitimately claim that you have used them, even if just in your own projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evaluating Courses
&lt;/h2&gt;

&lt;p&gt;Also, this knowledge will help you evaluate courses that you are considering. If a course includes a number of sought-after technologies, then it is probably better than one that teaches old or little-used or proprietary technologies.&lt;/p&gt;

&lt;p&gt;Bottom line - look at job ads and keep familiar with the technologies in use in the modern workplace. Learn about them and if you get a chance, use them in your own projects.&lt;/p&gt;

</description>
      <category>career</category>
      <category>programming</category>
      <category>job</category>
      <category>developer</category>
    </item>
    <item>
      <title>Help! My Else Clause Never Executes!</title>
      <dc:creator>Abraham Gumba</dc:creator>
      <pubDate>Thu, 20 Jul 2023 17:15:18 +0000</pubDate>
      <link>https://forem.com/owentechke/help-my-else-clause-never-executes-3cia</link>
      <guid>https://forem.com/owentechke/help-my-else-clause-never-executes-3cia</guid>
      <description>&lt;p&gt;Sometimes people write code with if/else statements, but the else statements never execute, regardless of what they type in to be checked in their conditions. &lt;br&gt;
Let us consider two examples of such cases.&lt;br&gt;
I will use Python to illustrate the points.&lt;/p&gt;
&lt;h2&gt;
  
  
  Scenario 1: if a or b
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user_answer = input("Do you want to continue? y/n: ")
if user_answer == "y" or "Y":
    print("You chose 'Yes.'")
else:
    print("You chose 'No.'")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The output of this code will always be "You chose 'Yes.'" &lt;br&gt;
Why is that? Because "Y" evaluates to True and therefore, the second part of the if condition - the part that says &lt;em&gt;or "Y"&lt;/em&gt; - will always be True.&lt;/p&gt;

&lt;p&gt;Any non-empty string will evaluate to True. &lt;/p&gt;

&lt;p&gt;Also, non-empty containers such as lists, tuples, sets or dictionaries will evaluate to True.&lt;/p&gt;

&lt;p&gt;The same applies for non-zero numbers.&lt;/p&gt;

&lt;p&gt;You can play around with the following code to test this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_variable = "" #no space

if my_variable:
    print("It is True")
else:
    print("It is False")

my_variable = 1 # 1

if my_variable:
    print("1 is True")
else:
    print("1 is False")

my_variable = 0 # 0

if my_variable:
    print("0 is True")
else:
    print("0 is False")

my_variable = [] #empty list

if my_variable:
    print("[] is True")
else:
    print("[] is False")

my_variable = [0] # list with an element

if my_variable:
    print("[0] is True")
else:
    print("[0] is False")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, back to our code. How do we fix it?&lt;br&gt;
The solution is simple: we &lt;strong&gt;write our conditions in full&lt;/strong&gt;, as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if user_answer == "y" or user_answer == "Y":
    print("You chose 'Yes.'")
else:
    print("You chose 'No.'")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our program will now check our condition and act as expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scenario 2: if not a or not b
&lt;/h2&gt;

&lt;p&gt;Consider the following piece of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user_answer = input("Do you want to continue? y/n: ")
if user_answer != "n" or user_answer != "N":
    print("You chose 'Yes.'")
else:
    print("You chose 'No.'")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output of this code will always be "You chose 'Yes.'" &lt;br&gt;
Why is that?&lt;/p&gt;

&lt;p&gt;For ease of reference, let us name our conditions as follows:&lt;/p&gt;

&lt;p&gt;We will call &lt;em&gt;user_answer != "n"&lt;/em&gt; Condition A and we will call &lt;em&gt;user_answer != "N"&lt;/em&gt; Condition B.&lt;/p&gt;

&lt;p&gt;Now, since we have use the &lt;strong&gt;or&lt;/strong&gt; operator, only one of the two conditions needs to be True for the if statement to evaluate to True.&lt;/p&gt;

&lt;p&gt;So if only Condition A is True, then that is enough for the if to be True.&lt;br&gt;
Similarly, if only Condition B is True, then that is enough for the if to be True.&lt;/p&gt;

&lt;p&gt;The thing is, whatever user_answer is, at least one of the conditions will be True.&lt;br&gt;
If user_answer is "n" then it is NOT "N" so Condition B is True.&lt;br&gt;
If user_answer is "N" then it is NOT "n" so Condition A is True.&lt;br&gt;
If user_answer is one of the two options, then the other condition is True.&lt;/p&gt;

&lt;p&gt;If user_answer is "74" then it is NOT "n" so Condition A is True and Condition B is also True.&lt;/p&gt;

&lt;p&gt;So, in the above example, the if statement will always be True and any else or elif statements will never be executed.&lt;/p&gt;

&lt;p&gt;How do we fix this? Well, that depends on the actual logic of your program. One simple fix is to replace 'or' with 'and' as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user_answer = input("Do you want to continue? y/n: ")
if user_answer != "n" and user_answer != "N":
    print("You chose 'Yes.'")
else:
    print("You chose 'No.'")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means that the if condition will be True only if user_answer is not "n" and it also is not "N"&lt;br&gt;
If user_answer is "n", then Condition A becomes False and hence the whole if statement becomes False (since it uses 'and').&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>coding</category>
      <category>python</category>
      <category>debugging</category>
    </item>
    <item>
      <title>Is Coding For You? Four Simple Questions.</title>
      <dc:creator>Abraham Gumba</dc:creator>
      <pubDate>Fri, 14 Jul 2023 15:02:49 +0000</pubDate>
      <link>https://forem.com/owentechke/is-coding-for-you-four-simple-questions-1fjd</link>
      <guid>https://forem.com/owentechke/is-coding-for-you-four-simple-questions-1fjd</guid>
      <description>&lt;p&gt;Someone shared the triangle puzzle below in a Facebook group. It's fairly straightforward but requires attention to detail and some imagination and logic. I thought this puzzle could be a simple test of whether or not someone would enjoy and probably thrive in programming. I think you can tell by asking yourself four simple questions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IPiVCx-L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8jr5mr1k7ks15m8r8e7u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IPiVCx-L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8jr5mr1k7ks15m8r8e7u.png" alt="Image description" width="411" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; Does the very idea of &lt;strong&gt;figuring out&lt;/strong&gt; this puzzle appeal to you? Is this something that you would voluntarily do or do you find it bothersome or a waste of time? Do you like mental puzzles?&lt;br&gt;
Programming involves figuring things out - how something can be done, or why something is not working or why it is working. A programmer is usually not just satisfied that something works, they want to know why, partly so that next time they face a similar problem they can fix it easily, but also partly out of sheer curiosity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; Are you able to &lt;strong&gt;visualise&lt;/strong&gt; the triangles in your mind, or do you have to draw or mark them? Many times, a programmer has to visualise how a program would work, without actually writing out the program. Or they look at an existing program and imagine what would happen if someone ran it, thus figuring out possible loopholes or errors that might arise. It is often impractical to actually spend time writing possibly lengthy pieces of code, just to find out where the problem is. Sometimes other pieces of the system are not in your control, so you have to simply think about what would happen if you changed something on your end, without changing the other parts that are inaccessible to you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt; If someone shows you the &lt;strong&gt;solution for one level&lt;/strong&gt; of the triangle, will you be able to see the rest of them? Often when searching for solutions online, you may not find sample code that matches your exact problem. You may get something close, then you will need to apply the principles and the logic to your own program. You need to understand the principles and apply them as needed in your own situation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4)&lt;/strong&gt; Can you see the triangles? All of them? A programmer needs to have &lt;strong&gt;an eye for detail&lt;/strong&gt;. Sometimes a missing comma or missing parenthesis may make your program not work as expected or not work at all.&lt;/p&gt;

&lt;p&gt;So, how may triangles are there?&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>logic</category>
      <category>coding</category>
      <category>mindset</category>
    </item>
    <item>
      <title>Getting Started With APIs - Bonus Tasks</title>
      <dc:creator>Abraham Gumba</dc:creator>
      <pubDate>Tue, 04 Jul 2023 10:56:42 +0000</pubDate>
      <link>https://forem.com/owentechke/getting-started-with-apis-bonus-122n</link>
      <guid>https://forem.com/owentechke/getting-started-with-apis-bonus-122n</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/owentechke/getting-started-with-apis-4pa1"&gt;Getting Started With APIs - Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/owentechke/getting-started-with-apis-part-2-4ka8"&gt;Getting Started With APIs - Part 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/owentechke/getting-started-with-apis-bonus-122n"&gt;Getting Started With APIs - Bonus Tasks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Story So Far
&lt;/h2&gt;

&lt;p&gt;In our &lt;a href="https://dev.to/owentechke/getting-started-with-apis-4pa1"&gt;first article in this series&lt;/a&gt;, we looked at what APIs are and what they are used for. In the &lt;a href="https://dev.to/owentechke/getting-started-with-apis-part-2-4ka8"&gt;second article&lt;/a&gt;, we wrote a simple Python program that fetches some data from an API. &lt;/p&gt;

&lt;p&gt;In this article, we will introduce a loop, so that we can get historical data over a period of time, then we will use this historical data and matplotlib to create a chart.&lt;/p&gt;

&lt;p&gt;We are using the API from ExchangeRatesAPI.io because their free plan allows us to fetch historical data. &lt;/p&gt;

&lt;p&gt;In previous steps, we already created an account at ExchangeRatesAPI.io and got a free API Key. We also installed the requests library and matplotlib, and imported them into the program we wrote. The program fetches exchange rate data for a specified date and gives us the data in JSON format, which we then convert into a nested Python dictionary.&lt;/p&gt;

&lt;p&gt;Here is the program we developed in the last article.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import requests
import matplotlib.pyplot as plt

my_key = "my_very_secret_key:-)"

my_url="http://api.exchangeratesapi.io/v1/2022-06-15?access_key="+my_key

response = requests.get(my_url)

my_dict = response.json()

print(my_dict)
# Get the rates nested dictionary
my_dict['rates']

# Get the Kenya Shilling rate from the rates dictionary
my_dict['rates']['KES'] # Of course, you can change this to a currency of your choice.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5FRvONFH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ngxz8a0rclq6ra6zcq75.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5FRvONFH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ngxz8a0rclq6ra6zcq75.jpg" alt="Image description" width="800" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Task Now
&lt;/h2&gt;

&lt;p&gt;Now, the URL that we use in our request is similar to the one below.&lt;br&gt;
my_url="&lt;a href="http://api.exchangeratesapi.io/v1/2022-06-15?access_key=%22+my_key"&gt;http://api.exchangeratesapi.io/v1/2022-06-15?access_key="+my_key&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice that it has a date hard-coded in it. In this example it is 2022-06-15, in the format specified by the API provider.&lt;br&gt;
We are interested in getting values for different years. That means we need to send several requests, each with a different date. It also means that we need to replace the fixed date in our URL with a variable one. &lt;/p&gt;

&lt;p&gt;We will use a for loop to do these two things.&lt;/p&gt;

&lt;p&gt;Before we do that, though, we will need two lists: one that will contain the years we are interested in, and another that will contain the exchange rate values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_years = []
exch_rates = []
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can create our loop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for my_year in range(2000, 2024):
   my_url="http://api.exchangeratesapi.io/v1/"+str(my_year)+"-06-15?access_key="+my_key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have replaced the hard-coded year with a variable that ranges from 2000 to 2023.&lt;br&gt;
(The range function stops 1 number before the number specified in the second argument).&lt;/p&gt;

&lt;p&gt;Get the response, convert to a dictionary and pick out the exchange rate we want.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    response = requests.get(my_url)

    my_dict = response.json()

    exch_rate = my_dict['rates']['KES']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We append the current year in our loop and the exchange rate to the lists we created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    my_years.append(my_year)
    exch_rates.append(exch_rate)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's really it for retrieving the data.&lt;/p&gt;

&lt;p&gt;In case you are wondering why we retrieve all the exchange rates when we are only interested in one, it's because the free plan on ExchangeratesAPI.io does not allow us to retrieve data for only specified currencies.&lt;/p&gt;

&lt;p&gt;Now we use matplotlib to draw a chart of the exchange rate trend, display the chart and also save it as an image file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Set the figure size and create the plot
plt.figure(figsize=(8, 6))
plt.plot(my_years, exch_rates, color='red')

# Customize the plot
plt.title("Euro to KES Rates (Years 2000 to 2023)", fontsize='16')
plt.xlabel("Year", fontsize='13', color='green')
plt.ylabel("Euro-KES Rate", fontsize='13', color='blue')
plt.minorticks_on()
plt.grid(True, which='major', linestyle='-', linewidth=0.5)
plt.grid(True, which='minor', linestyle=':', linewidth=0.5)

# Save and show the plot
plt.savefig('EuroExRatesAPI_io.png')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I will not describe the matplotlib commands. They are fairly straightforward, and you can always look up the documentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion and Next Steps
&lt;/h2&gt;

&lt;p&gt;And there it is! We have modified our program to get data for multiple dates, store them, draw a chart, show the chart and also save it as a file.&lt;/p&gt;

&lt;p&gt;I hope you found the articles useful. &lt;/p&gt;

&lt;p&gt;You could now try a little arithmetic and use this info that was retrieved (for exchange rates against the Euro) to get the exchange rate against a different currency, such as KES to USD.&lt;/p&gt;

&lt;p&gt;Or you could simply look for an API that is based on the US Dollar and allow you to retrieve historical data.&lt;/p&gt;

&lt;p&gt;You could also learn a bit more about matplotlib and plot different currencies on the same chart.&lt;/p&gt;

&lt;p&gt;Or, of course, you could fetch data for something entirely different.&lt;br&gt;
Here is the list of APIs that I shared earlier.&lt;br&gt;
&lt;a href="https://apislist.com/"&gt;APIsList&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Enjoy your coding!&lt;/p&gt;




&lt;h3&gt;
  
  
  One-on-One Lessons
&lt;/h3&gt;

&lt;p&gt;If you wish to have one-on-one lessons in Python or PHP or if you need support from time to time as you go through coding lessons from elsewhere, please consider the &lt;a href="https://owendevs.com/coding-lessons/"&gt;lessons&lt;/a&gt;/service that I offer.&lt;/p&gt;

</description>
      <category>api</category>
      <category>python</category>
      <category>programming</category>
    </item>
    <item>
      <title>Getting Started With APIs - Part 2</title>
      <dc:creator>Abraham Gumba</dc:creator>
      <pubDate>Mon, 26 Jun 2023 22:18:46 +0000</pubDate>
      <link>https://forem.com/owentechke/getting-started-with-apis-part-2-4ka8</link>
      <guid>https://forem.com/owentechke/getting-started-with-apis-part-2-4ka8</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/owentechke/getting-started-with-apis-4pa1"&gt;Getting Started With APIs - Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/owentechke/getting-started-with-apis-part-2-4ka8"&gt;Getting Started With APIs - Part 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/owentechke/getting-started-with-apis-bonus-122n"&gt;Getting Started With APIs - Bonus Tasks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In our &lt;a href="https://dev.to/owentechke/getting-started-with-apis-4pa1"&gt;previous article&lt;/a&gt;, we looked at what APIs are and what they are used for. In this article, we will create a simple Python program that fetches some data from an API and displays it for us.&lt;/p&gt;

&lt;p&gt;We will fetch some currency exchange rate data from an API. I chose exchange rate data because it is something of general interest in many situations and it changes frequently, so we can collect data from many different points in time and it is easy to understand.&lt;/p&gt;

&lt;p&gt;We will use the API from ExchangeRatesAPI.io because the free plan allows us to fetch historical data (that is, exchange rates from years ago, not just the latest data). So first we create an account at ExchangeRatesAPI.io and get a free API Key.&lt;/p&gt;

&lt;h3&gt;
  
  
  JSON
&lt;/h3&gt;

&lt;p&gt;Modern APIs will usually provide data in a format known as JSON. &lt;br&gt;
JSON stands for &lt;strong&gt;J&lt;/strong&gt;avaScript &lt;strong&gt;O&lt;/strong&gt;bject &lt;strong&gt;N&lt;/strong&gt;otation. You can think of it as text that is a combination of nested lists and dictionaries.&lt;/p&gt;
&lt;h3&gt;
  
  
  Required Libraries
&lt;/h3&gt;

&lt;p&gt;We will use the &lt;em&gt;requests&lt;/em&gt; library to retrieve our data and then use &lt;em&gt;matplotlib&lt;/em&gt; to draw a chart.&lt;br&gt;
So if you have not installed them on your computer already, do so using the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install requests
pip install matplotlib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Writing the Program
&lt;/h3&gt;

&lt;p&gt;Now we open our code editor and import the libraries we need&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import requests
import matplotlib.pyplot as plt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put our key in a variable&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_key = "my_very_secret_key:-)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The website tells us how to format the URL from which we will get data.&lt;br&gt;
To get data for a particular date, we build our URL as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_url="http://api.exchangeratesapi.io/v1/2022-06-15?access_key="+my_key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Of course, our program will include our API key using our variable.&lt;/p&gt;

&lt;p&gt;Now we use the requests library to actually request data from the API, and we put the data we get in a variable that we call response.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;response = requests.get(my_url)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hopefully, our request succeeds and we get data back in our response variable.&lt;/p&gt;

&lt;p&gt;Now we decode the JSON data and create a dictionary.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_dict = response.json()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API work is done and we have the data we wanted in a Python dictionary.&lt;/p&gt;

&lt;p&gt;Now we need to see what the dictionary contains, so that we can write code to read the data that we want.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print(my_dict)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives us a dictionary similar to the one below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{'success': True, 'timestamp': 1686873599, 'historical': True, 'base': 'EUR', 'date': '2023-06-15', 'rates': {'AED': 4.020203, 'AFN': 95.768652, 'ALL': 108.047527, 'AMD': 423.09078, 'ANG': 1.974017, 'AOA': 771.664273, 'ARS': 271.969319, 'AUD': 1.590929, 'AWG': 1.972942, 'AZN': 1.862114, 'BAM': 1.975735, 'BBD': 2.211514, 'BDT': 118.566312, 'BGN': 1.955594, 'BHD': 0.412651, 'BIF': 3108.547253, 'BMD': 1.094559, 'BND': 1.470457, 'BOB': 7.568468, 'BRL': 5.265597, 'BSD': 1.095367, 'BTC': 4.2789129e-05, 'BTN': 89.91324, 'BWP': 14.604557, 'BYN': 2.764734, 'BYR': 21453.354281, 'BZD': 2.207807, 'CAD': 1.447374, 'CDF': 2599.577405, 'CHF': 0.976188, 'CLF': 0.031478, 'CLP': 868.576114, 'CNY': 7.794386, 'COP': 4540.230284, 'CRC': 593.092317, 'CUC': 1.094559, 'CUP': 29.005811, 'CVE': 110.767138, 'CZK': 23.783701, 'DJF': 195.020391, 'DKK': 7.452197, 'DOP': 60.036308, 'DZD': 148.488214, 'EGP': 33.819024, 'ERN': 16.418383, 'ETB': 59.587725, 'EUR': 1, 'FJD': 2.404635, 'FKP': 0.862334, 'GBP': 0.856115, 'GEL': 2.851369, 'GGP': 0.862334, 'GHS': 12.422979, 'GIP': 0.862334, 'GMD': 64.962433, 'GNF': 9473.407221, 'GTQ': 8.581587, 'GYD': 231.660586, 'HKD': 8.562444, 'HNL': 27.057605, 'HRK': 7.635765, 'HTG': 152.793754, 'HUF': 373.211501, 'IDR': 16313.305725, 'ILS': 3.890687, 'IMP': 0.862334, 'INR': 89.658547, 'IQD': 1433.324869, 'IRR': 46253.320449, 'ISK': 149.308898, 'JEP': 0.862334, 'JMD': 169.148999, 'JOD': 0.776484, 'JPY': 153.535419, 'KES': 153.130492, 'KGS': 95.872728, 'KHR': 4507.393904, 'KMF': 497.282543, 'KPW': 985.111936, 'KRW': 1390.500264, 'KWD': 0.335909, 'KYD': 0.912823, 'KZT': 495.910438, 'LAK': 20019.482106, 'LBP': 16708.441214, 'LKR': 336.27293, 'LRD': 192.203727, 'LSL': 19.943151, 'LTL': 3.231947, 'LVL': 0.662088, 'LYD': 5.270323, 'MAD': 10.946139, 'MDL': 19.578544, 'MGA': 4887.205568, 'MKD': 61.614093, 'MMK': 2300.139493, 'MNT': 3798.768281, 'MOP': 8.829589, 'MRO': 390.757336, 'MUR': 49.85683, 'MVR': 16.806933, 'MWK': 1120.828595, 'MXN': 18.748589, 'MYR': 5.063395, 'MZN': 69.230773, 'NAD': 19.943322, 'NGN': 668.77519, 'NIO': 40.006138, 'NOK': 11.491999, 'NPR': 143.862835, 'NZD': 1.755612, 'OMR': 0.42137, 'PAB': 1.095266, 'PEN': 3.98255, 'PGK': 3.853141, 'PHP': 61.066515, 'PKR': 314.631085, 'PLN': 4.452066, 'PYG': 7922.940974, 'QAR': 3.984739, 'RON': 4.961199, 'RSD': 117.232733, 'RUB': 91.373514, 'RWF': 1253.269931, 'SAR': 4.105339, 'SBD': 9.122395, 'SCR': 15.44215, 'SDG': 658.376667, 'SEK': 11.608766, 'SGD': 1.463031, 'SHP': 1.331804, 'SLE': 24.660449, 'SLL': 21617.538357, 'SOS': 623.34455, 'SRD': 41.159858, 'STD': 22655.159157, 'SVC': 9.583698, 'SYP': 2750.109355, 'SZL': 19.942876, 'THB': 37.860899, 'TJS': 11.949936, 'TMT': 3.830956, 'TND': 3.366313, 'TOP': 2.565972, 'TRY': 25.892667, 'TTD': 7.43007, 'TWD': 33.568263, 'TZS': 2613.80642, 'UAH': 40.446956, 'UGX': 4041.780803, 'USD': 1.094559, 'UYU': 42.10483, 'UZS': 12560.062875, 'VEF': 2953639.788524, 'VES': 29.631276, 'VND': 25760.443521, 'VUV': 129.856769, 'WST': 2.963242, 'XAF': 662.652115, 'XAG': 0.045838, 'XAU': 0.000559, 'XCD': 2.9581, 'XDR': 0.8215, 'XOF': 663.851026, 'XPF': 119.853865, 'YER': 273.907364, 'ZAR': 19.952769, 'ZMK': 9852.341387, 'ZMW': 21.139584, 'ZWL': 352.447517}}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our interest is the nested dictionary called 'rates' which contains currency codes and the exchange rates on the date we selected.&lt;/p&gt;

&lt;p&gt;To get the 'rates' dictionary, we use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_dict['rates']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and to get the 'KES' rate within the 'rates' dictionary, we use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_dict['rates']['KES']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;And there we have it! We have written a simple program that connects to an API, gets JSON data, converts it to a dictionary and extracts the specific information we want.&lt;/p&gt;

&lt;p&gt;In our next article, we will look at getting data for multiple dates, so that we can generate a chart showing a trend.&lt;/p&gt;




&lt;h3&gt;
  
  
  One-on-One Lessons
&lt;/h3&gt;

&lt;p&gt;If you wish to have one-on-one lessons in Python or PHP or if you need support from time to time as you go through coding lessons from elsewhere, please consider the &lt;a href="https://owendevs.com/coding-lessons/"&gt;lessons&lt;/a&gt;/service that I offer.&lt;/p&gt;

</description>
      <category>api</category>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Getting Started With APIs - Part 1</title>
      <dc:creator>Abraham Gumba</dc:creator>
      <pubDate>Tue, 20 Jun 2023 09:35:09 +0000</pubDate>
      <link>https://forem.com/owentechke/getting-started-with-apis-4pa1</link>
      <guid>https://forem.com/owentechke/getting-started-with-apis-4pa1</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/owentechke/getting-started-with-apis-4pa1"&gt;Getting Started With APIs - Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/owentechke/getting-started-with-apis-part-2-4ka8"&gt;Getting Started With APIs - Part 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/owentechke/getting-started-with-apis-bonus-122n"&gt;Getting Started With APIs - Bonus Tasks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article first appeared on &lt;a href="https://owendevs.com/2023/06/getting-started-with-apis/"&gt;OwenDevs.com&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;A lot of modern programming requires the use of an API of some sort. &lt;/p&gt;

&lt;h3&gt;
  
  
  What is an API?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;API&lt;/em&gt;&lt;/strong&gt; stands for &lt;strong&gt;A&lt;/strong&gt;pplication &lt;strong&gt;P&lt;/strong&gt;rogramming &lt;strong&gt;I&lt;/strong&gt;nterface. This is basically an interface (a portion of software that is placed between two systems) that allows programs outside that software to interact with it. &lt;/p&gt;

&lt;p&gt;For example, you may develop some software that requires your clients to make some payment through a third party. Your software will therefore send some information to the third party's payment system to initiate the transaction. You will then want to know if the customer has successfully made the payment. The payment system will send some information back to your software with the relevant payment details. The outside-facing parts of the payment system that receive and send information are what is known as an API.&lt;/p&gt;

&lt;p&gt;A simpler example is a website that allows you to simply retrieve and read some information from within it. One example is YouTube, which allows you to programmatically find out details of a channel such as the number of videos the channel has, number of subscribers, views and so on.&lt;/p&gt;

&lt;p&gt;A system that has an API will usually provide information on what information your program should send in order to request some information or to initiate a transaction. It will usually also specify what kind of information you will get back.&lt;/p&gt;

&lt;h3&gt;
  
  
  API Keys
&lt;/h3&gt;

&lt;p&gt;The system that allows interaction with outside parties often wants to know who it is interacting with. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DPgWBPPm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b0w6509k1kw56pgt8mre.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DPgWBPPm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b0w6509k1kw56pgt8mre.jpg" alt="key" width="800" height="523"&gt;&lt;/a&gt;&lt;br&gt;
One of the reasons for this is that some systems offer free services as well as paid services, so they need to know who has paid and therefore what they are entitled to. &lt;/p&gt;

&lt;p&gt;Another reason is to place limits on the number of requests each user can send, in order to avoid overwhelming the system.&lt;/p&gt;

&lt;p&gt;To identify and keep track of who is using the system without having the user log in each time, the systems usually use what are known as API keys. &lt;/p&gt;

&lt;p&gt;An API key is simply a unique set of alphanumeric characters that is assigned to each user. After you have been given your API key, you normally include it in the information that you send to the API, so that it knows who is sending the information.&lt;/p&gt;

&lt;p&gt;An API key may be something like: '4fd8mb187d3g1ew29fd62u37abf7n819'&lt;br&gt;
This example is a made-up key. :-)&lt;/p&gt;

&lt;p&gt;Some APIs allow free access to their data, without the use of API keys.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where To Find APIs
&lt;/h3&gt;

&lt;p&gt;There are many APIs available to the public on the Internet. I have already mentioned YouTube. You can find numerous others at the link below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://apislist.com/"&gt;APIsList&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/owentechke/getting-started-with-apis-part-2-4ka8"&gt;next article&lt;/a&gt;, we will look at a program that retrieves some information from an API and presents it as a chart.&lt;/p&gt;

&lt;h3&gt;
  
  
  One-on-One Lessons
&lt;/h3&gt;

&lt;p&gt;If you wish to have one-on-one lessons in Python or PHP or if you need support from time to time as you go through coding lessons from elsewhere, please consider the &lt;a href="https://owendevs.com/coding-lessons/"&gt;lessons&lt;/a&gt;/service that I offer.&lt;/p&gt;

</description>
      <category>api</category>
      <category>programming</category>
      <category>beginners</category>
      <category>datascience</category>
    </item>
    <item>
      <title>I Have Learnt The Basics. What Next?</title>
      <dc:creator>Abraham Gumba</dc:creator>
      <pubDate>Mon, 12 Jun 2023 18:23:43 +0000</pubDate>
      <link>https://forem.com/owentechke/i-have-learnt-the-basics-what-next-1oi2</link>
      <guid>https://forem.com/owentechke/i-have-learnt-the-basics-what-next-1oi2</guid>
      <description>&lt;p&gt;This article first appeared on &lt;a href="https://owendevs.com/2023/06/12/i-have-learnt-the-basics-what-next/"&gt;OwenDevs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One somewhat common question from beginner programmers goes something like: "I have learnt the basics of [programming language]. What should I do next?" To be honest, I find this question rather surprising. I would imagine that while learning a programming language, you get exposed to the uses of that language and the problems it can be used to solve. This exposure should trigger your imagination about what you can do yourself with what you are learning. As a result, after learning the basics, you should be having a number of ideas of what programs you want to write to solve various problems or to handle various tasks.&lt;/p&gt;

&lt;p&gt;Nevertheless, let us look at three things you can do after you have learnt the basics. (I have deliberately not provided links because, as a developer, you will be expected to search the Internet for answers for yourself).&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Build a Project
&lt;/h3&gt;

&lt;p&gt;The first suggestion has already been hinted at above: build something. Write a program that does something for you. What the program does can be a relatively small task like fetching a headline from a specific site every day, or automatically moving certain files from one folder to another. You can choose anything that interests you and start working on it. &lt;/p&gt;

&lt;p&gt;Building a project has a number of benefits. &lt;/p&gt;

&lt;p&gt;First, many people learn to code with the aim of getting employed. Building a project allows you to have something to show potential employers to showcase your skills. For this reason, try to choose something unique and useful to make yourself stand out. &lt;/p&gt;

&lt;p&gt;A second benefit is that building a project really makes you concentrate on the details. Code demands that you put in every required comma and and parentheses. Building something and getting it to work will make you concentrate and find out exactly how things ought to be done.&lt;/p&gt;

&lt;p&gt;Third, building a project actually makes you learn a lot. Your project will present various challenges of how to make one part of your program work well with another part of your program. While finding out how to address these challenges, you will come across various solutions, approaches and technologies used by other coders and you may use these yourself in the current program or in future.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;As a bonus tip&lt;/strong&gt;, look for a friend or relative and offer to develop something for them to use in their work for free. You will gain in three ways: you will get real-life experience, you will gain a reference (if you do a good job!) and you will gain lots of confidence.&lt;/p&gt;

&lt;p&gt;There are dozens of project ideas available online.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Learn Something Specialised
&lt;/h3&gt;

&lt;p&gt;There are various areas of software development, from web development, mobile app development to various automation tasks, among others. If there is a particular area you want to get into, then you can find and take more specialised courses in your area of interest. &lt;/p&gt;

&lt;p&gt;You could look into sites like Coursera and Udemy for a wide range of courses.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Join A Bigger Project
&lt;/h3&gt;

&lt;p&gt;If you have no idea what project you can build yourself, then you can join an existing project. There are many open-source projects that constantly look for volunteers of all skill levels to join the projects. Joining a project will, again, give you real-life experience, will expose you to more technologies, will give you a chance to work as part of a team and has the potential to connect you to people who might give you work opportunities.&lt;/p&gt;

&lt;p&gt;Search the Internet for information on how to join an open-source project.&lt;/p&gt;

&lt;p&gt;So, as we say in my country, "So much to do, so little time!" Stop wondering what to do next and start working on something.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>beginners</category>
      <category>project</category>
      <category>roadmap</category>
    </item>
  </channel>
</rss>
