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
Keyword | RGB hex value | |
---|---|---|
black | #000000 | |
silver | #c0c0c0 | |
gray | #808080 | |
white | #ffffff | |
maroon | #800000 | |
red | #ff0000 | |
purple | #800080 | |
fuchsia | #ff00ff | |
green | #008000 |
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
veg_dict = {'cabbage': 3.57, 'carrot': 2.99, 'spinach': 4.13, 'asparagus': 3.56, 'artichoke': 4.00, 'lettuce': 3.83} | |
fruit_dict = {'peach': 0.65, 'banana': 0.23, 'watermelon': 2.45, 'apple': 0.99, 'dragonfruit': 1.23} | |
store_dict = {**veg_dict, **fruit_dict} | |
order1 = {'cabbage': 3, 'spinach' : 3, 'artichoke': 5, 'apple': 10, 'banana': 7} | |
order2 = {'dragonfruit': 10, 'apple': 4, 'lettuce': 2} | |
order1_total = 0 | |
order2_total = 0 |
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
veg_dict = {'cabbage': 3.57, 'carrot': 2.99, 'spinach': 4.13, 'asparagus': 3.56, 'artichoke': 4.00, 'lettuce': 3.83} | |
fruit_dict = {'peach': 0.65, 'banana': 0.23, 'watermelon': 2.45, 'apple': 0.99, 'dragonfruit': 1.23} | |
store_dict = {**veg_dict, **fruit_dict} | |
order1 = {'cabbage': 2, 'spinach' : 3, 'artichoke': 5, 'apple': 10, 'banana': 7} | |
order_total = 0 | |
for item, quantity in order1.items(): | |
order_total += store_dict[item] * quantity |
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
veg_dict = {'cabbage': 2.87, 'carrot': 1.59, 'spinach': 3.33, 'asparagus': 2.54, 'artichoke': 3.00, 'lettuce': 2.43} | |
order1 = {'cabbage': 2, 'spinach' : 3, 'artichoke': 5} | |
order_total = 0 | |
for veggie, quantity in order1.items(): | |
order_total += veg_dict[veggie] * quantity | |
print(order_total) |
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 libraries | |
import requests | |
import urllib.request | |
import time | |
from bs4 import BeautifulSoup | |
# Set the URL you want to webscrape from | |
url = 'http://web.mta.info/developers/turnstile.html' | |
# Connect to the URL |
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 generate_wordcloud(words, mask): | |
word_cloud = WordCloud(width = 512, height = 512, background_color='white', stopwords=STOPWORDS, mask=mask).generate(words) | |
plt.figure(figsize=(10,8),facecolor = 'white', edgecolor='blue') | |
plt.imshow(word_cloud) | |
plt.axis('off') | |
plt.tight_layout(pad=0) | |
plt.show() | |
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 wordcloud import WordCloud, STOPWORDS | |
from PIL import Image | |
import urllib | |
import requests | |
import numpy as np | |
import matplotlib.pyplot as plt | |
words = 'access guest guest apartment area area bathroom bed bed bed bed bed bedroom block coffee coffee coffee coffee entrance entry francisco free garden guest home house kettle kettle kitchen kitchen kitchen kitchen kitchen kitchenliving located microwave neighborhood new park parking place privacy private queen room san separate seperate shared space space space street suite time welcome' | |
mask = np.array(Image.open(requests.get('http://www.clker.com/cliparts/O/i/x/Y/q/P/yellow-house-hi.png', stream=True).raw)) |