College of Business & Technology
East Tennessee State University
This course introduces students to both programming fundamentals and computational thinkingโthe problem-solving skills that make programming powerful.
We'll learn Python while developing the mindset that helps us break down complex problems into manageable pieces.
This makes it accessible to beginners while remaining powerful for experts.
Use Python for data processing, visualization, machine learning, and AI in fields like bioinformatics and business analytics
Create modern, custom web applications with frameworks like Django and Flask
Control robots, create chatbots, voice assistants, and home automation systems
๐กWith modern conversational AI, it's easier than ever to create your own apps! You should still know how to code because AI makes mistakes!
๐ฏThis is exactly how programming works - computers need explicit, detailed instructions for everything!
"Before we dive into programming concepts, let's experience computational thinking with a real problem you face in class: forming teams!"
Setting: You have 100+ students who need project teams of equal size. How would you solve this manually?
Microsoft Forms collect student information automatically
Excel responses cleaned and organized (abstraction!)
Automated tool randomly assigns equal teams
Breaking big problems into smaller, manageable pieces
Team formation: broke into attendance โ calculation โ assignment โ communicationFinding similarities and trends
Team formation: recognized repeated classroom needFocusing on what's important, ignoring unnecessary details
Team formation: only cared about names, not IDs or timestampsCreating step-by-step instructions that always work
Team formation: form โ clean โ generate โ displayPython reads almost like English! Let's see how our team formation logic would look in code:
# Our team formation algorithm in Python
with open('student_names.txt', 'r') as file:
students = file.read().splitlines() # Read names (like our Excel step)
team_size = 4
teams = []
for i in range(0, len(students), team_size): # Pattern recognition!
team = students[i:i + team_size]
teams.append(team)
for i, team in enumerate(teams, 1): # Communication step
print(f"Team {i}: {', '.join(team)}")
๐กDon't worry about understanding every detail yet โ notice how it follows the same logical steps we identified!
Before continuing, open an online Python interpreter such as this one so you can copy and paste the code examples. When you click "Run", You'll get to see the results! Try tweaking the code examples and watching the output change!
Think of variables as labeled boxes that store informationโjust like how we stored student names in our digital form.
# Creating our first variables (like storing form responses)
name = "Chelsie"
age = 42
height = 5.7
likes_koalas = True
print("Hello! My name is", name)
print("I am", age, "years old")
Just like we organized different information in our team formation (names vs. numbers vs. true/false), Python has different data types:
Text in quotes
student_name = "Taylor Swift"
class_section = "CSCI-1100-001"
Whole numbers
total_students = 127
team_size = 4
Decimal numbers
average_team_size = 4.2
gpa = 3.85
True or False
attendance_form_submitted = True
has_partner_preference = False
print("This displays on screen!")
print("We have", 127, "students today!")
# Modern Python way with f-strings (like our team display)
student_name = "Taylor"
team_number = 3
print(f"{student_name} is assigned to Team {team_number}!")
# Advanced f-string formatting
average_score = 87.6789
print(f"Team average: {average_score:.1f}%") # Shows: 87.7%
Create variables about yourself and use print() to display a personal profile, similar to how our form collected and displayed information.
name = input("What's your name?: ") # Won't continue until you press the enter key
print(f"Nice to meet you, {name}!")
# Getting numbers - int() converts it from string (str) to integer (int)
age = int(input("How old are you?: "))
print(f"You'll be {age+10} in 10 years!")
# Building an interactive profile collector
favorite_subject = input("What's your favorite subject?: ")
graduation_year = int(input("What year do you graduate?: "))
print(f"{name} loves {favorite_subject} and graduates in {graduation_year}!")
Combine input() and print() to create an interactive program that asks users for their information and displays it back nicely formatted.
Remember our list of student names? Python lists work the same way:
todo_list = ["Clean room", "Do homework", "Work out"]
# Break a string up into a list with the *split* function!
shopping_list_string = "apples,bread,eggs"
shopping_list = shopping_list_string.split(",")
print(shopping_list) # prints ['apples', 'bread', 'eggs']
todo_list = ["Clean room", "Do homework", "Work out"]
# Indexing: "Clean room"
print("The first item in the to-do list is: " + todo_list[0])
# Indexing: "Do homework"
print(f"The second item in the to-do list is: {todo_list[1]}") # f-string
# Indexing: "Work out"
print(f"The third item in the to-do list is: {todo_list[2]}") # f-string
Why start from 0? Think of it as "how many steps from the beginning"
Lists aren't just for storing - you can modify them as you complete tasks and get new ones!
todo_list = ["Clean room", "Do homework", "Work out"]
# How many items do we have?
print(f"I have {len(todo_list)} tasks to complete")
# Completed a task? Remove it!
todo_list.remove("Clean room")
print("โ
Cleaned my room!")
print(f"Tasks remaining: {todo_list}")
# Got a new task? Add it to the end!
todo_list.append("Call grandma")
print(f"Updated list: {todo_list}")
print(f"Now I have {len(todo_list)} tasks")
Create your own dynamic to-do list that changes as you work through it!
Remember when our team formation tool had to decide if we had enough students for even teams? That's Boolean logic!
# Scenario: Should you take an umbrella?
is_raining = True
has_hood = True
is_windy = True
# Don't need umbrella if it's NOT raining
# Or if you have a hood and it's NOT windy
need_umbrella = is_raining and not (has_hood and not is_windy)
if need_umbrella:
print("Take your umbrella! โ")
else:
print("No umbrella needed today! ๐")
# Fun fact: I made a smart alarm clock with Python in college.
# It checked wind, humidity, rain to recommend my outfits using if/elif/else decisions! - Prof Haas
age = 65
is_student = False
if age >= 65 or is_student:
print("โ
Eligible for discount")
else:
print("โ Not eligible for discount")
# Boolean variables in action
form_completed = True
valid_name_entered = True
can_assign_to_team = form_completed and valid_name_entered
print(can_assign_to_team) # True
We can combine multiple conditions to make complex decisions, just like our team formation tool checks multiple criteria before assigning students.
Remember how our team generator automatically assigned all students without us doing it manually? That's the power of loops!
students = ["Maxwell", "Chidi", "Monika"]
print("Welcome", students[0])
print("Welcome", students[1])
print("Welcome", students[2])
students = ["Maxwell", "Chidi", "Monika"]
for student in students:
print(f"Welcome {student}!")
# Creating team numbers (like our generator tool)
for number in range(1, 6): # range starts from 1, goes up to (but doesn't include) 6
print(f"Counting: {number}")# Prints 1 2 3 4 5 on separate lines
students = ["Maxwell", "Chidi", "Monika"]
students_count = len(students) # The *len* function stores 3 to students_count (students_count = 3)
# Using the range function to print a numbered list!!
print('Team Koalas:')
print("-"*20)
for index in range(students_count): # Loops through indices of the list (0, 1, 2)
count = index + 1 # Human-friendly numbering
print(f"{count}. {students[index]}")
# Like waiting for all students to submit the form
# Interactive form submission example
students_submitted = 0
total_students = 6 # Pretend class size is 6
print("Please enter your name to submit the form.\n")
while students_submitted < total_students: # Repeat the next 3 lines until students_submitted is 6
name = input("Enter your name: ")
students_submitted += 1 # Add one to the count
print(f"Thanks, {name}! Submission received. ({students_submitted}/{total_students})\n")
# Only prints after the loop stops
print("All students have submitted! Time to generate teams!")
โ ๏ธBe careful with while loops! Make sure the condition will eventually become False, or your program will run forever.
When calculating team sizes, order of operations matters:
# Calculating teams with different approaches
total_students = 127
base_team_size = 4
extra_members = 3
# Wrong way (without parentheses)
result = total_students / base_team_size + extra_members
print(result) # 34.75 (not what we want!)
# Right way (with parentheses)
result = total_students / (base_team_size + extra_members)
print(result) # 18.14 (makes more sense!)
# Like updating our attendance count
students_present = 120
print(f"Currently: {students_present} students")
# More students arrive
students_present = students_present + 7
# ๐ Cool way
students_present += 3 # Same as: students_present = students_present + 3
print(f"Updated: {students_present} students")
How to efficiently form teams in a large class
Decomposition, Pattern Recognition, Abstraction, Algorithm Design
Variables, data types, lists, loops, boolean logic, and functions
Now that you know input(), varables and decisions, you're ready to create a chatbot that responds differently based on what users say!
# Simple chatbot template
bot_name = "Ryan Bot"
print(f"๐ค Hi! I'm {bot_name}. What's your name?")
user_name = input("Your name: ")
print(f"Nice to meet you, {user_name}!")
print("How are you feeling today?")
mood = input("Your mood: ").lower() # .lower() makes it not case-sensitive
if mood == "happy" or mood == "good" or mood == "great":
print("๐ That's awesome! I'm happy you're doing well!")
elif mood == "sad" or mood == "bad" or mood == "tired":
print("๐ Sorry to hear that. I hope your day gets better!")
else:
print(f"๐ค Hmm, {mood} is interesting! Thanks for sharing!")
print(f"It was nice chatting with you, {user_name}! ๐")
Create a personalized chatbot that asks questions and responds based on the answers!
We've seen that programming isn't just about writing codeโit's about developing a systematic way of thinking that helps you solve problems efficiently.
Apply these concepts to personal projects and daily challenges
Find computational thinking opportunities in your daily life
If you want to continue learning Python, check out this resource
Every expert was once a beginner who kept practicing!
๐ฏ Key Achievement: You now understand both the how (Python syntax) and the why (computational thinking) of programming!