Skip to content

Instantly share code, notes, and snippets.

View zhongleqi's full-sized avatar

Leqi Zhong zhongleqi

View GitHub Profile
@zhongleqi
zhongleqi / leqi_assignment5_draft3.py
Created February 17, 2023 07:55
I hope this will be the last draft :(
import os
import requests
import json
def main():
members = get_members_data()
parties = group_members_by_party(members)
dems = parties[0]
reps = parties[1]
#print(json.dumps(reps, indent=4))
@zhongleqi
zhongleqi / leqi_assignment5_draft2.py
Created February 13, 2023 09:40
assignment 5 draft 2
import os
import requests
import json
def main():
members = get_members_data()
grouped_members = group_members_by_party(members)
sort_member = sort_member(grouped_members)
print(json.dumps(members, indent=4))
@zhongleqi
zhongleqi / leqi_assignment5_draft1.py
Last active February 11, 2023 20:36
don't know what I'm doing...
import os
import requests
import json
def main():
data = get_members_data()
for members in data['results'][0]['members']:
print(members)
grouped_members = group_members_by_party(members)
@zhongleqi
zhongleqi / filter_animals.py
Last active January 23, 2023 21:21
Leqi Zhong, Programming in Journalism, Assignment 1. Jan. 23, 2023
animals = ['cat', 'dog', 'canary', 'chihuahua', 'narwhal']
filtered_animals = []
number = 0
for animal in animals:
if (animal[0]) == "c":
filtered_animals.append(animal.upper())
number = number + 1
print(filtered_animals, "Number of C-animals: ", number)
@zhongleqi
zhongleqi / failed_banks_ca.sh
Created January 18, 2023 06:54
Leqi Zhong, Programming in Journalism, Assignment 0. Jan. 17, 2023
#!/bin/bash
# Silence the output of curl and write the results to specified file
curl -s --output banklist.csv https://www.fdic.gov/resources/resolutions/bank-failures/failed-bank-list/banklist.csv
# TODO: create ca_failed_banks.csv
# It must have the same header row as the original file (banklist.csv)
# Check out exercises/bash_drill.md (in this GitHub repo online)
# for pointers on getting the first line of a file
# and redirecting the content to a new file.