Week 8 - Python Introduction - 15th October 2024
Week 8 - Python Introduction - 15th October 2024
Class # 8
Tuesday
Table of Contents
Agenda.................................................................................................................................... 3
R Algorithms............................................................................................................................ 3
Factors.................................................................................................................................... 3
Factors and Read Tables..................................................................................................... 4
Logical Rules........................................................................................................................... 5
Logical Conditions................................................................................................................... 6
If and else............................................................................................................................ 7
Ifelse.................................................................................................................................... 7
Loops...................................................................................................................................... 8
For ( ).................................................................................................................................. 8
While Loops......................................................................................................................... 9
Repeat Loops....................................................................................................................... 9
Executing a File Script........................................................................................................... 10
Agenda
Final project details
Python
o Introduction
o Create Environment
Final Project
About the data set provided: which is the record of a grocery shop transactions for about
two and a half months from 05/17/2023 to 07/31/2023.
Grade Distribution
Project grades will be:
Guidelines:
You all should be working on the project
Each one has to be working on the coding side
You may implement the project using either R or Python
You need to think of your group as a company
You need to think of the problem as a customer problem
You need to design a solution that customers favor/pick your solution over
other companies in the market
Professor comments:
o Curate the best possible code that accurately defines the trend of a consumer
purchasing pattern and determine the top 5 products which may be purchase
together.
Python Script
Vocabulary/Words – Variables and Reserved Words.
Sentence structure – valid syntax patterns.
Story structure – constructing a program for a purpose.
Interactive python is good for experiments and program of 3-4 lines long.
Most programs are much longer, so we type them into a file and tell Python to run
the commands in the file.
In a sense, we are “giving Python a script”.
As a convention, we add “.py” as the suffix on the end of these files to indicate they
contain Python
Python – Notes
just run everything, no need to see a line by line. Run the file.