python short project

profilee201611
ElectoralCollegeProjectPython.pptx

Project #2: Electoral College Simulator

Overview

CMSC 190: Introduction to Python

Project Description

Project Details

Project Technical Requirements

Project Deliverables

Grading / Policies

Project Description

In the spirit of U.S. election day (or election week/month, in light of recent circumstances!), we’re going to do some work with electoral college data!

This will be a project oriented towards working with data and basic data analysis on a dataset I’ve curated for you

CMSC 190: Introduction to Python

Project Description (cont’d)

538 total electoral votes available, distributed across the U.S.

Number of electoral votes in each state is roughly proportional to population

The winner (by popular vote) of each state will (likely**) take all electoral votes associated with the state (winner-take-all)

The first candidate to 270 (over half the total) is the winner of the election

CMSC 190: Introduction to Python

Project Description (cont’d)

This process is non-deterministic (otherwise, what would be the purpose of elections?)

Each party has “safe” states (states it’s highly likely to win)

It ultimately comes down to “swing” states, which could ultimately tilt to either party, and put them over the 270 threshold

There can also be ties!

Or there can be one state which decides the winner (a “breaking point state” – see the 2000 election)

For more cool stuff about this:

https://projects.fivethirtyeight.com/2020-election-forecast/,

https://www.270towin.com/

CMSC 190: Introduction to Python

Project Description (cont’d)

I am providing some basic data (name, electoral votes, party lean) about the 50 U.S. states in a file

For lean: ‘R’ is Red (Republican), ‘B’ is blue (Democrat), and ‘P’ is purple (swing state)

I want you to read in the file, do some data analysis and generate some visualizations, which I will specify in the requirements

This project tests some of the concepts we’ve discussed since last project, such as File IO, try-except, loops, lists/tuples, and string parsing

CMSC 190: Introduction to Python

Project Details

This project can be either group or individual

Groups can be no more than 3 people

Email me letting me know if you plan to do the project in a group

You will have from Wednesday (11/04) to the following Thursday (11/11) to submit

There will be no lectures or daily/weekly assignments during that time, as I want everyone to focus on this

However, there will be office hours at their scheduled time, as well as on an as needed basis (just email/text me)

CMSC 190: Introduction to Python

Project Technical Requirements

Function to read data from the file and transform it into a format for processing (i.e; a list of tuples)

Bar plot displaying the distribution of electoral votes per party and swing

Simulations where swing states “swing” to one party or another, and how that effects the outcomes (how many times is there an ‘R’ win, how many times is there a ‘B’ win, ties, breaking point state situations)

Do something else interesting and explain it! 

Project should capture almost every core concept we’ve covered in class thus far

CMSC 190: Introduction to Python

Project Deliverables

A report with some of the visualizations and outcomes observed

Code (either as a zip file or on github, which is extra credit)

Also include a brief section in report about contribution if done in a group

CMSC 190: Introduction to Python

Grading and Policies

Recall from the syllabus, this project is worth 20% of your overall grade

Grades will be determined based on requirements being met, as well as (if you decide to work as a team) the contributions of each team member (the work should be evenly split)

If any piece of your code is not syntactically correct (a “compile time” error), the final grade will be a 0

Code should not just be one big script! Logic should be decomposed into reasonable functions which are called and pass data around (this will be penalized)

CMSC 190: Introduction to Python