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
class Point: | |
def __init__(self, x, y, name): | |
self.x = x | |
self.y = y | |
self.name = name | |
def get_coordinate(self): | |
return (self.x, self.y) | |
def set_name(self, name): |
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
class Point: | |
def __init__(self, x, y, name): | |
self.x = x | |
self.y = y | |
self.name = name | |
def get_coordinate(self): | |
return (self.x, self.y) | |
def set_name(self, name): |
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 pandas as pd | |
d = pd.read_excel('filename.xlsx') | |
total = 0 | |
number_of_rows = len(d) | |
for i in range(number_of_rows): | |
if d['ORIG_MESH_250M'][i] == d['DEST_MESH_250M'][i]: | |
total = total + (d['TRIP_COUNT_EX'][i]*100) | |
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
# Your previous Python 2 content is preserved below: | |
# | |
# ### ASCII Maze Master | |
# | |
# # Write a program that will find a path through a simple maze. A simple maze in this context is a maze where all of the walls are connected to each other. Take this example maze segment. | |
# | |
# ''' | |
# # # ### # | |
# # # | |
# # ### B # |
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
def plot_tool_release_industry_usage(version_name, industry): | |
if version_name == "all": | |
session = Session.objects.all().select_related() | |
if industry != "all": | |
session = session.filter(user__industry=industry) | |
else: | |
session = Session.objects.filter(version_name=version_name).select_related() | |
if industry != "all": | |
session = session.filter(user__industry=industry) |
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 math import ceil | |
import requests | |
from bs4 import BeautifulSoup | |
def get_soup(url, headers, payload): | |
total_pages = 0 | |
r = requests.get(url, params=payload, headers=headers) | |
soup = BeautifulSoup(r.text, 'html5lib') |
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 requests | |
from bs4 import BeautifulSoup | |
def get_soup(url, headers, payload): | |
total_pages = 0 | |
r = requests.get(url, params=payload, headers=headers) | |
soup = BeautifulSoup(r.text, 'html5lib') | |
return soup |
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 reqeusts | |
url = 'http://salesforce.careermount.com/candidate/job_search/quick/results' | |
payload = { | |
'location': 'California', | |
'keyword': 'software', | |
'sort_dir': 'desc', | |
'sort_field': 'post_date', | |
'relevance': 'false' |
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 reqeusts | |
url = 'http://salesforce.careermount.com/candidate/job_search/quick/results' | |
payload = { | |
'location': 'California', | |
'keyword': 'software', | |
'sort_dir': 'desc', | |
'sort_field': 'post_date', | |
'relevance': 'false' |
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
def apply_async(func, args, *, callback): | |
result = func(*args) | |
callback(result) | |
def add(x, y): | |
return x + y | |
# Using closure |
NewerOlder