This file contains hidden or 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
const x = 5; | |
x = 4; | |
console.log("Did you know? " + GodsOfDeathLoveApples); |
This file contains hidden or 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
{ | |
"base": { | |
"Attack": 49, | |
"Defense": 49, | |
"HP": 45, | |
"Sp.Atk": 65, | |
"Sp.Def": 65, | |
"Speed": 45 | |
}, | |
"name": "Bulbasaur", |
This file contains hidden or 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
def dirReduc(arr): | |
directions = { | |
"NORTH" : "SOUTH" , | |
"SOUTH" : "NORTH" , | |
"WEST" : "EAST" , | |
"EAST" : "WEST" | |
} | |
for i in range(len(arr)-1): | |
move = arr[i] |
This file contains hidden or 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
# Quick test for skipping index within loop | |
nums = [1,2,3,4,5,6,7,8,9,10] | |
for i in range(len(nums)): | |
print(i) | |
num = nums[i] | |
if(num % 2 == 0): | |
i += 5 | |
# Doh! prints 0-9 |
This file contains hidden or 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
def dirReduc(arr): | |
directions = { | |
"NORTH" : "SOUTH" , | |
"SOUTH" : "NORTH" , | |
"WEST" : "EAST" , | |
"EAST" : "WEST" | |
} | |
output = [] | |
i = 0 | |
while(i < len(arr)-1): |
This file contains hidden or 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
def dirReduc(arr): | |
if(len(arr) <= 1): # short circuit | |
return arr | |
directions = { | |
"NORTH" : "SOUTH" , | |
"SOUTH" : "NORTH" , | |
"WEST" : "EAST" , | |
"EAST" : "WEST" | |
} |
This file contains hidden or 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
# All credit to the following users on Code Wars: | |
# aenik97, CSNqwer, kickh, joei26, suhlob | |
opposite = {'NORTH': 'SOUTH', 'EAST': 'WEST', 'SOUTH': 'NORTH', 'WEST': 'EAST'} | |
def dirReduc(plan): | |
new_plan = [] | |
for d in plan: | |
if new_plan and new_plan[-1] == opposite[d]: | |
new_plan.pop() | |
else: |
This file contains hidden or 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 * | |
FROM actor AS a | |
INNER JOIN film_actor AS fa ON a.actor_id = fa.actor_id | |
INNER JOIN film AS f on f.film_id = fa.film_id |
This file contains hidden or 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
-- https://stackoverflow.com/questions/11056235/finding-rows-with-same-values-in-multiple-columns | |
SELECT A.* | |
FROM YourTable A | |
INNER JOIN (SELECT Address, State | |
FROM YourTable | |
GROUP BY Address, State | |
HAVING COUNT(*) > 1) B | |
ON A.Address = B.Address AND A.State = B.State |
OlderNewer