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
f = open("AOCDay1.txt", "r") | |
with open('AOCDay1.txt') as f: | |
elf_calories = [line.rstrip('\n') for line in f] | |
elves = [] | |
i = 0 | |
# we have to create the array element before we can add to it | |
elves.insert(i, '') | |
for elf in elf_calories: |
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
see |
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
with open("Day1_input.txt", "r") as f: | |
modules = [int(x) for x in f.readlines()] | |
#part 1 | |
fuel = sum((y // 3 - 2) for y in modules) | |
print(fuel) | |
#3390596 | |
#holyshit | |
#part 2 |
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
with open("Day1_input.txt", "r") as f: | |
modules = [int(x) for x in f.readlines()] | |
#part 1 | |
fuel = sum((y // 3 - 2) for y in modules) | |
print(fuel) | |
#3390596 | |
#holyshit | |
#part 2 |
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
9XCBT-WBXFR-5TRWJ-JJJ33-TX53Z - 1 Key | |
ZFKJ3-TT6FF-KTFKT-T3JJT-JWX36 - 1 Key | |
HXKBT-XJ6FR-WBRKJ-J3TTB-RSBHR - 1 Key | |
ZRWBJ-ST6XR-CBFKT-JT3J3-FRXJ5 - 1 Key | |
ZFKJ3-TT3BB-JTBJT-T3JJT-JWX9H - 3 Keys | |
Z65B3-JCXX6-5JXW3-3B33J-9SWT6 - 1 Key | |
EXPIRED | |
5SWBT-X93RW-HHRXB-JBJBB-T63JC |
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
Month 1: | |
1. Intro to SQL for Data Science | |
2. Joining Data in SQL | |
3. Introduction to Relational Databases in SQL | |
4. Intermediate SQL | |
Challenge: https://adventofcode.com/2018/day/9 (Using SQL/T-SQL only) |
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
SELECT OD.PartNum AS OPN, QD.PartNum AS QPN, OD.OrderNum, OD.OrderLine, OD.QuoteNum, OD.QuoteLine | |
FROM Epicor10.erp.OrderHed AS OH | |
LEFT JOIN Epicor10.erp.OrderDtl AS OD ON OD.OrderNum = OH.OrderNum | |
RIGHT JOIN Epicor10.erp.QuoteDtl AS QD ON OD.QuoteNum = QD.QuoteNum AND OD.QuoteLine = QD.QuoteLine AND | |
SUBSTRING(OD.PartNum, PATINDEX('%[^0]%', OD.PartNum+'.'), LEN(OD.PartNum)) <> SUBSTRING(QD.PartNum, PATINDEX('%[^0]%', QD.PartNum+'.'), LEN(QD.PartNum)) | |
WHERE OH.OrderDate > DATEADD(month, -24, GETDATE()) |
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
pum_mod2 <- function(conv_factor, value) { | |
mod <- 0 | |
case_when( | |
value < conv_factor ~ mod <- ceiling(conv_factor - value), | |
value %% conv_factor != 0 ~ mod <- ceiling((value / conv_factor) * conv_factor - value), | |
) | |
return(mod) | |
} |
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
SELECT EntryPerson, AVG((DATEDIFF(hh, ReceivedDate_c, DateTimeCreated_c) + CASE WHEN Datepart(dw, ReceivedDate_c) = 7 THEN 1 ELSE 0 END) - DATEDIFF(wk, | |
ReceivedDate_c, DateTimeCreated_c) * 2 - CASE WHEN Datepart(dw, ReceivedDate_c) = 1 THEN 1 ELSE 0 END + - CASE WHEN Datepart(dw, DateTimeCreated_c) | |
= 1 THEN 1 ELSE 0 END) AS Turnaround, CONVERT(DECIMAL(16, 2), 24) AS HoursInDay | |
FROM Epicor10.dbo.OrderHed | |
WHERE (ReceivedDate_c > DATEADD(month, - 3, GETDATE())) AND (ReceivedDate_c <= DateTimeCreated_c) AND (ReceivedDate_c IS NOT NULL) AND | |
(DateTimeCreated_c IS NOT NULL) AND (EntryPerson IN ('amberl', 'kaitlynn', 'cathys', 'jeffo', 'jamesh', 'keeleighc', 'morganp', 'michelled', 'jenellef', 'elviae', 'faitha', | |
'ronniel', 'johnh')) AND (DATEDIFF(dd, ReceivedDate_c, DateTimeCreated_c) < 30) | |
GROUP BY EntryPerson |
NewerOlder