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 random | |
import string | |
def create_password(): | |
"""Creates a random 25-character alphanumeric password""" | |
chars = string.ascii_letters + string.digits | |
return "".join(random.choice(chars) for i in range(25)) | |
print("Your new password is:", create_password()) |
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
# Get started with the Twitter API at https://projects.raspberrypi.org/en/projects/getting-started-with-the-twitter-api | |
# Get started with PiCamera at https://projects.raspberrypi.org/en/projects/getting-started-with-picamera | |
# Twitter updates (API, updates, following) at https://support.twitter.com/articles/15364 | |
# Recommend setting up a separate private Twitter account so that you don't inundate followers with photos | |
from picamera import PiCamera, Color | |
from time import sleep | |
from datetime import datetime | |
from twython import Twython | |
from twitter_auth import ( |
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
artless | base-court | apple-john | ||
---|---|---|---|---|
bawdy | bat-fowling | baggage | ||
beslubbering | beef-witted | barnacle | ||
bootless | beetle-headed | bladder | ||
churlish | boil-brained | boar-pig | ||
cockered | clapper-clawed | bugbear | ||
clouted | clay-brained | bum-bailey | ||
craven | common-kissing | canker-blossom | ||
currish | crook-pated | clack-dish | ||
dankish | dismal-dreaming | clotpole |
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 inspiration from chapter 21 of The Self-Taught Programmer by Corey Althoff | |
class Stack: | |
"""a stack is a LIFO data structure where the last item put in is the first item taken out""" | |
def __init__(self): | |
self.items = [] | |
def push(self, item): | |
"""adds a new item to the stack""" | |
return self.items.append(item) |
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 ninety_nine_bottles(): | |
for n in range(99, 0, -1): | |
b = "bottles" if n > 1 else "bottle" | |
verse = f"{n} {b} of beer on the wall, \ | |
\n{n} {b} of beer, \ | |
\nYou take one down and pass it around," | |
if n > 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
# just for fun | |
# correct plural and singular usage of 'bottle' throughout | |
for n in range(99,0,-1): | |
b = 'bottles' if n > 1 else b[:-1] | |
h = 'of beer' | |
w = 'on the wall' | |
v = f'{n} {b} {h} {w}, {n} {b} {h}, take one down, pass it around,' | |
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
# By AO8 | |
# January 13, 2018 | |
import urllib.request | |
import re | |
from bs4 import BeautifulSoup | |
from datetime import datetime as dt | |
dow_jones_page = "https://www.bloomberg.com/quote/INDU:IND" | |
html = urllib.request.urlopen(dow_jones_page) |
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 urllib.request | |
import csv | |
import re | |
from bs4 import BeautifulSoup | |
from datetime import datetime as dt | |
dow_jones_page = "https://www.bloomberg.com/quote/INDU:IND" | |
html = urllib.request.urlopen(dow_jones_page) | |
soup = BeautifulSoup(html, "html.parser") |
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 Stack: | |
"""a stack is a LIFO data structure where the last item put in is the first item taken out""" | |
def __init__(self): | |
self.items = [] | |
def push(self, item): | |
"""adds a new item to the stack""" | |
return self.items.append(item) | |
def pop(self): |
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
# 1. Use a simple print command | |
print("python"[::-1]) | |
# 2. Use join() and reversed() | |
print("".join(reversed("python"))) | |
# 3. Use a function, for loop, join(), and reversed() | |
def reverse_string(string): | |
st = [] | |
for i in string: |