Skip to content

RaphaelSheikh/python-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

python-challenge

Background

Transitioning from using Excel to programming with Python, I've undertaken an assignment involving two Python challenges: PyBank and PyPoll. These tasks are designed to apply my new Python scripting skills to real-world scenarios.

Before I Begin

Before starting the assignment, the following steps needs to be completed:

Before diving into the assignment, I followed these preparatory steps:

  1. Repository Setup: Created a new repository named python-challenge.
  2. Cloning the Repository: Cloned the repository to my local machine.
  3. Directory Structure: Created two folders within the repository: PyBank and PyPoll.
  4. File Preparation: Within each folder, added:
    • main.py: The main script for the analysis.
    • Resources folder: Contained the necessary CSV files.
    • analysis folder: Held the text file with the results of the analysis.
  5. Pushing Changes: Committed and pushed these changes to GitHub/GitLab.

PyBank Instructions

image

Objective

Develop a Python script to analyze financial records in a dataset named budget_data.csv, containing two columns: "Date" and "Profit/Losses".

Tasks

  • Calculate the total number of months included in the dataset.
  • Compute the net total amount of "Profit/Losses" over the period.
  • Calculate the changes in "Profit/Losses" over the period and find the average of these changes.
  • Identify the greatest increase in profits (date and amount).
  • Identify the greatest decrease in profits (date and amount).

Deliverables

  • Print the analysis results to the terminal.
  • Export a text file with the analysis results.

My analysis should align with the following results:

image

PyPoll Instructions

image

Objective Create a Python script to modernize the vote-counting process using data from election_data.csv, which contains "Voter ID", "County", and "Candidate" columns.

Tasks

  • Determine the total number of votes cast.
  • Generate a complete list of candidates who received votes.
  • Calculate the percentage of votes each candidate received.
  • Calculate the total number of votes each candidate received.
  • Identify the winner of the election based on the popular vote.

Deliverables

  • Print the analysis results to the terminal.
  • Export a text file with the analysis results.

My analysis should align with the following results:

image

Hints and Considerations

  • Use Python modules like csv for file handling.
  • Utilize data structures such as variables, lists, and dictionaries for data storage and manipulation.
  • Employ iteration for processing data.
  • Debug the scripts to ensure accuracy.
  • Handle large datasets efficiently, showcasing the limitations of Excel and the advantages of Python scripting.

Workflow

  1. Script Development: Write separate scripts for each dataset.
  2. Testing: Run each script individually to verify functionality.
  3. Version Control: Commit work regularly and push changes to GitHub to prevent data loss.
  4. Documentation: Ensure the repository includes a comprehensive README.md file detailing the project.

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages