Lecture 1: Introduction to Python for Business
2025-08-25
The answer is simple: data is everywhere, and the ability to understand and use it is no longer optional, it’s essential.
Data is the New Oil, and Python is the Refinery:
Competitiveness Demands More Than Just Spreadsheets:
Industry Trends Point to One Thing -> Automation and AI:
Following along with the professor...
Shift + Enter
.#
, ##
, ###
*text*
or _text_
**text**
or __text__
* Item
1. Item
[Text](URL)
=
) to assign values to variables.Once a variable is defined, you can use it later in your program. Here we use the print function to display the contents of each variable.
We will see the print function being used more in later classes. For now, note that you can provide not only variables, but text.
For very long lines of code, we can specify to continue on the next line as folllows:
myVar
is different from myvar
).if
, for
, while
).str
): Text (e.g., "Hello"
, 'ISM4641'
).int
): Whole numbers (e.g., 10
, -5
, 0
).float
): Decimal numbers (e.g., 3.14
, -2.7
).bool
): True
or False
.Python has a built-in function called type that we can use to identify the data type of a variable.
. . .
+
, -
, *
, /
, //
, %
, **
).==
, !=
, >
, <
, >=
, <=
).and
, or
, not
).int()
: Converts to an integer.float()
: Converts to a float.str()
: Converts to a string.Open a new notebook in Google Colab and try these exercises.
Create variables for as persons name, their age, the city they live in, and if there are a member:
. . .
. . .
Print the values and their data types.
Calculate the total cost given price per item, quantity, and discount:
. . .
. . .
Print the total cost after the discount.
Determine if eligible for free shipping given based on the the rule that members with orders over $50 get a discount:
. . .
. . .
Print True
if eligible, False
otherwise.
Create a text cell with:
purchase_total_str = "125.75"
purchase_total_float
ISM4641 Python for Business © 2025 Tim Smith
Comments: Explaining your code
# This is a comment