How To Learn Artificial Intelligence in Banking: Part 1 - Quick Tutorial in Python

Banking Skills for the Next Decade

We recently taught a banking class in bank technology and there was this pervasive undertone that artificial intelligence was the domain of large banks. Nothing could be farther from the truth. The state of machine learning is such that almost any banker with the curiosity to understand can leverage machine learning for a variety of tasks from marketing, to credit, to risk management. In order to prove this democratization of technology concept, we are starting a five-part series that will take any banker that wants to put in five hours of work from knowing nothing about programming to learning the elements of deploying artificial intelligence.


About This Series - Ignore This Series At Your Peril


Of all the banking skills to learn to keep your banking career relevant to the next decade, it is learning the basics of coding and being able to use artificial intelligence that should be at the top of everyone's list. Not to say that you will be coding, but chances are that you will be interfacing with those that are creating and deploying code. Having a working knowledge of programming will give you a huge leg up in managing this process and creating new applications. 


In banking, navigating a changing technological landscape is difficult but it is made even more difficult when a banker has little to no computer science experience. Pushing yourself to gain this experience will provide huge returns in the near future while boosting your confidence to take on any new learning domain. The purpose of this blog series is to highlight the power of computer programming and eventually demystify artificial learning. In this blog, we will discuss a few basic computer science concepts and walk you through building your own ROI calculator using Python. With a 45 minute investment of time, many bankers will have their first coding experience by the end of this lesson. 


Computers are Fast but Stupid


Writing a computer program is like a lot like writing a teleprompter script for Ron Burgundy, whatever you write will be executed, for better or for worse. If written correctly, the computer will execute your program faster, more accurately, and more efficiently than an entire department of human beings. But, there is no margin of error or intelligent comprehension that will assist you when writing code. Glaring error messages and creative problem solving is the norm when drafting code that your computer can properly interpret. The primary purpose of using computer programs in banking is to invest time and resources now to speed up repeated processes in the future.


Basic Terminology


In this blog, we hope to make clear some of the most basic terms in computer science. This ground floor understanding of computer science should give you some insight into the logic of a computer and the mechanisms of a program.




There is a multitude of computer languages, each with specific purposes. Below, are some of the more common ones used in banking and their purposes.


Popular Coding Languages for Banks


We will also add that ironically, there are a few banks that still use “second-generation” languages like COBOL largely due to legacy systems but also for security as few hackers understand it.


While there are countless computer languages, the principals of each language translate seamlessly with each other. Many people believe that once you learn one language, you truly learn them all.


In addition, languages come with libraries, which are akin to tools in a tool belt. While there is typically base level functionality in these languages, sometimes you will need to import an additional library to complete your task.


Variables, Types, and Operations


Variables are storage locations in your computer’s memory. Much like a cell in excel, your computer has a lot of memory that can fit values different types. Types are just different types of data, integers, floating point numbers, Boolean values, and characters are all examples of types. Think of a variable as a cell reference in excel, while the cell holds the value assigned a distinct type.


Integers are counting numbers without decimal values. Ex. (1, 3, 200, 103420)


Floating point numbers or Doubles are numbers with decimal values used for calculations. Ex. (1.2, 40022.65, 5.0)


Boolean values are binary values reserved for true and false.


Characters and Strings are values that can hold letters and character values. Ex (“words”, ‘c’, “sentences too”)


Much like a calculator or excel, variables and values of the same type can interact with each other using operations. For example, adding integers 1 and 2 equals 3 or 2  > 3 = false. However, it is very important to be conscientious of the types you are interacting with. Because integers do not hold decimal values, calculations always round down. For example, 15 / 9 equals 1 using integer division.


Instructions for Building an ROI Calculator


Like many skills, the best way to improve at computer programming is by going hands-on and just doing it. Throwing yourself at a project and embracing mistakes is the best way to learn. Furthermore, when you get stuck, be sure to use Google, Stack Overflow (a website where developers exchange ideas), and the documentation of the language, often found on the language’s website or built into your integrated development environment (IDE), to troubleshoot for solutions. We will now build an ROI calculator on Python.


Step 1: Select an IDE. An IDE, or integrated development environment, is an application that provides tools to computer programmers such as debugging, building, and editing. When writing programs, you need to have some sort of place to house, compile, and run your code. Popular IDEs include Sublime, Visual Studio, and X-Code. For this project, we will be using the user-friendly, web-based, "codeskulptor" which is a code editor, or like Word for the code. 


You can start a project by just clicking this URL .


Step 2: Import libraries and create a description of your program using a comment. We will be using some extra math functionalities, so we need to import the math library. Comments are a great way to keep track of what you are doing. A computer program is only as good as it is easy to understand. In Python, just use a hashtag and then type your comment in.


Bank Code Example


Step 3: Initialize and define your variables. For this project, we need to set up the variables for the amount invested, amount returned, and time. In addition, we need to assign values to these variables, specifically floating type values.


For “amountInvested” we used 1000.0, for “amountReturned” we used 2300.0, and for “time” we used 2.5 (time is in years). Notice how I am commenting around the variables.


Code example for banking


Step 4: Calculate the values. Now we must convert the ROI formula into code by using the variables we have created. It is also a good idea to store the result of this calculation in a variable so we can use it for output later.


We have also calculated the annualized return. Annualized Return = (1+ Return)(1/N) – 1. In order to implement this formula, we went to the math library and used math.pow(), which gives us the ability to use exponents in Python.


code example for banking


Step 5: Finally, we must output the code. The easiest way to output is to “print” the values to the “console” output screen. Using the Python function print(), we can print variables, strings, and other types to console. To output our values as percentages, multiply them by 100 and put a “%” to be printed on the end of the line. You will see that we separated our variables and our strings with commas, and the strings are put in quotations, so the computer can properly read and process the information.


bank code example


Your output should look similar to this. The extra blank print() was just to put a space between the two print statements.


Code example for banking


Below is a link to a completely built ROI calculator. It includes a couple more advanced techniques to make the input and output process more user-friendly and aesthetically pleasing, but the important calculations are all included in this tutorial. 


Computer programming is more than just a tremendous tool for community banks. The high level of thinking involved with programming, from understanding Boolean logic to engaging in complex problem solving, is applicable in many facets of business and banking. We hope this introduction to Python was helpful and provided a glimpse into the practicality of computer programming in a professional setting. We have barely scratched the surface of all the beneficial applications programming can provide to your bank.


While this blog series will not teach you enough to make products for customers, it will demystify coding, the value of automated banking and artificial intelligence. We at CenterState understand that the best place to operate is at the intersection of effective banking and efficient technology. We are working daily to implement better and more efficient processes into our workflow and in this series, we look to bring some of these concepts to life.


In the next blog, we will be taking bankers through the true calculating might of computer science through loops and functions.



About the Author: This is a guest post by Dan Kim, an analyst at CenterState Bank.