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
Java Questions | |
1. Why do we hide data behind getters and setters? | |
2. What is the difference between an `ArrayList` and a `LinkedList`? When should you use them? | |
3. Explain insides of a `HashMap` | |
4. Explain insides of a `TreeMap` | |
5. Abstract class vs interface | |
6. Why calling public methods in a constructor is a bad practice? | |
7. Overriding vs overloading | |
8. Explain exceptions (checked/unchecked) |
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
class example(object): | |
stuff = "nothing" | |
def test(): | |
return "Blah blah" | |
library = {1: "toy", | |
2: "box", |
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
import csv | |
import datetime | |
import matplotlib.pyplot as plt | |
with open('brentdata.csv') as f: | |
csv_data = csv.DictReader(f) | |
data = list(csv_data) | |
# Data now contains a list of dictionaries, each dictionary containing a line of the csv | |
# Here's what the dictionary equalling one line looks like |
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
import random | |
relationships = {'Spock': {'Scissors': 'smashes', 'Rock': 'vaporizes'}, | |
'Scissors': {'Paper': 'cuts', 'Lizard': 'decapitates'}, | |
'Lizard': {'Paper': 'eats', 'Spock': 'poisons'}, | |
'Rock': {'Lizard': 'crushes', 'Scissors': 'crushes'}, | |
'Paper': {'Spock': 'disapproves', 'Rock': 'covers'} | |
} | |
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
from urllib.request import urlretrieve | |
from time import sleep | |
import requests | |
from bs4 import BeautifulSoup as bs | |
def get_files(): | |
""" Gets files of specified extension through user input | |
from a specified full URL path; downloads each file to |
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
from unittest import TestCase | |
from triangle import get_num_divisors | |
class TestGet_num_devisors(TestCase): | |
def test_get_num_devisors(self): | |
assert get_num_divisors(1) == 1 | |
assert get_num_divisors(3) == 2 | |
assert get_num_divisors(6) == 4 |
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
+-----------------------+--------+---------+ | |
| Title | #Jobs | Avg.Sal | | |
+-----------------------+--------+---------+ | |
| Python Developer | 36670 | 97992 | | |
| Java Developer | 116285 | 98014 | | |
| C# Developer | 58974 | 95915 | | |
| C++ Developer | 36950 | 97905 | | |
| Ruby Developer | 22772 | 88315 | | |
| PHP Developer | 26466 | 75204 | | |
| HTML5 Developer | 31565 | 87505 | |
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
>>> from requests.auth import HTTPBasicAuth | |
>>> auth = HTTPBasicAuth('[email protected]', 'not_a_real_password') | |
>>> r = requests.post(url=url, data=body, auth=auth) | |
>>> r.status_code | |
201 | |
>>> content = r.json() | |
>>> print(content[u'body']) | |
Sounds great! I'll get right on it. |
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
import random | |
JAPANESE_CHARACTERS = [ | |
['いちまい', 'にまい', 'さんまい', 'よんまい', 'ごまい', 'ろくまい', 'ななまい', 'はちまい', 'きゅうまい', 'じゅうまい'], | |
['いっさつ', 'にさつ', 'さんさつ', 'よんさつ', 'ごさつ', 'ろくさつ', 'ななさつ', 'はっさつ', 'きゅうさつ', 'じゅさつ'], | |
['いっぽん', 'にほん', 'さんぼん', 'よんまい', 'ごまい', 'ろくまい', 'ななまい', 'はちまい', 'きゅうまい', 'じゅうまい'], | |
['ひとつ', 'ふたつ', 'みっつ', 'よっつ', 'いつつ', 'むっつ', 'ななつ', 'やっつ', 'ここのつ', 'とお'] | |
] | |
answer_selections = ["a", "b", "c", "d"] |