This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simulate a sports tournament | |
import csv | |
import sys | |
import random | |
# Number of simluations to run | |
N = 1000 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <time.h> | |
// each of our text files contains 1000 words | |
#define LISTSIZE 1000 | |
// values for colors and score (EXACT == right letter, right place; CLOSE == right letter, wrong place; WRONG == wrong letter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modifies the volume of an audio file | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
// Number of bytes in .wav header | |
const int HEADER_SIZE = 44; | |
int main(int argc, char *argv[]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Saves popular dog names in a trie | |
// https://www.dailypaws.com/dogs-puppies/dog-names/common-dog-names | |
#include <cs50.h> | |
#include <ctype.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
// Max number of candidates | |
#define MAX 9 | |
// preferences[i][j] is number of voters who prefer i over j | |
int preferences[MAX][MAX]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Practice working with structs | |
// Practice applying sorting algorithms | |
#include <cs50.h> | |
#include <stdio.h> | |
#define NUM_CITIES 10 | |
typedef struct | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cs50.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <ctype.h> | |
int only_letters(string text); | |
int repeated(string text); | |
char rotate(char c, string key); | |
int main(int argc, string argv[]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Practice using structs | |
// Practice writing a linear search function | |
/** | |
* Beach Burger Shack has the following 10 items on their menu | |
* Burger: $9.5 | |
* Vegan Burger: $11 | |
* Hot Dog: $5 | |
* Cheese Dog: $7 | |
* Fries: $5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import requests | |
def main(): | |
# Read NYTimes Covid Database | |
download = requests.get( | |
"https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-states.csv" | |
) | |
decoded_content = download.content.decode("utf-8") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cs50 import get_float | |
import decimal | |
def main(): | |
## Ask how many dollars the customer is owed | |
while True: | |
dollars = get_float("Change owned: ") | |
if dollars > 0: | |
break |
NewerOlder