Programming Languages

Module 1: Python Basics

Learning Objectives:

  • To be able to recognize the various components and keywords of a programming language
  • To be able to create simple programs and understand the basics of Python syntax.
  • To be able to use Python for data analysis.
  • To be able to use Python for machine learning and artificial intelligence.

Introduction

Welcome to Programming Languages! 

For an MBA student, the ability to code in Python is increasingly becoming a necessary skill set. This versatile and powerful language is being utilized by organizations large and small to create applications that automate processes and streamline operations. Additionally, coding in Python allows MBA students to gain valuable insights into complex data analytics, allowing them to better understand customer needs, build effective marketing campaigns, develop data-driven strategic business plans, and make better decisions for their organization. Knowing how to code in Python can give MBA students the essential tools they need to succeed in today's competitive business environment.

Discussion of Python Basics

  • Types
  • Expressions / Variables
  • String operations

First Program

Writing your first program in Python is an exciting step toward exploring programming languages.

  • The simplest Python program you can possibly write contains just a print statement.  The print statement displays the value inside the parentheses, known as an 'argument'.
  • Commenting your code will help tell other people what it does. Simply place a hash symbol (#) before your comment. Python will ignore this part when reading your code.
  • There can be two types of errors when writing Python code – Syntactic and Semantic.
    • A syntactic error is when Python doesn't understand your code.
    • A semantic error occur when the logic of the program is incorrect. For example, by entering python 102 instead of python 101.

Types

Python is a programming language that uses data types to represent different types of values. Types such as integers, floats, and Booleans are among the most commonly used in Python. An integer is designated by the int keyword and float refers to real numbers. String on the other hand is a type of sequence of characters found in Python. Functions such as type casting can convert data from one type to another, like converting an int to a float. Boolean has two possible states: true, designated by an uppercase T, and false designated with an uppercase F.

 

Expressions and Variables

Expressions are a central part of programming in Python, as they describe operations that the language performs. These operations range from basic arithmetic such as addition or subtraction to more complex ones like assigning values to variables and using them elsewhere in code. Python follows mathematical conventions when executing these expressions. Variables are also an important part of expressions. By assigning values with the assignment operator (equal sign), we can store these values and access them somewhere else in our code. We should always use meaningful variable names so it's easier to remember what each variable does and its value for future reference.

String Operations

Strings are an important part of Python. A string is a sequence of characters, which can be spaces, digits, or special characters, contained within either two or single quotes. Strings can be assigned to variables so they can be accessed more easily. Additionally, each element of the string’s sequence can be individually accessed through its index in the Python array. Since Python treats strings like lists and tuples, we can perform most sequence operations on them. Use caution when dealing with escape sequences because these indicate strings that may not be interpreted or seen by Python as originally intended.

NumPy vs. Pandas

Pandas and NumPy: Is one simply a superset of the other?

There's more to these two Python-based data analytics packages than that. 

Understand their relative strengths for determining the best approach for adopting one framework versus another.

Discussion of Packages

Conclusion

For an MBA student, understanding coding in Python is important for many reasons. Knowing the basics of types and expressions, variables, and string operations can help students understand and analyze data more efficiently and effectively. It is also beneficial for writing code that solves complex problems in quantitative analysis, predictive simulations, automated machine learning algorithms, and other business-related tasks. Additionally, knowing how to code in Python provides skills that employers value highly in today's job market. Overall, having a strong foundation in Python can be quite advantageous for an MBA student looking to gain an edge in the workplace.

Discussion of Python Basics

  • Types
  • Expressions / Variables
  • String operations