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 makelist(a): | |
| n = a.readline() | |
| n = n.rstrip() | |
| n = n.split("--") | |
| return n | |
| with open("birthday records.txt") as file: | |
| names = makelist(file) | |
| dobs = makelist(file) | |
| file.close() |
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
| #Rx Brand Name Generator by Scivias (Robyn Broyles) | |
| #Each name takes a randomly selected element for its beginning and another for its end. 5 out of 7 times, a third element is selected for the middle. | |
| import random | |
| def readfile(f): | |
| with open(f) as file: | |
| n = file.read() | |
| file.close() | |
| return n.split(",") |
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
| print("Draw a grid of any size, up to 32 cells in each direction!") | |
| def checknum(d): | |
| msg = "Please enter a whole number between 1 and 32." | |
| while True: | |
| fin = input("Enter the number of cells " + d + ": ") | |
| try: | |
| fin = float(fin) | |
| except ValueError: | |
| print(msg) |
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 requests | |
| from bs4 import BeautifulSoup | |
| def allstories(f): | |
| page=requests.get(f) | |
| soup=BeautifulSoup(page.text,"html.parser") | |
| print("STORIES CURRENTLY ON NYTIMES.COM (in order of appearance):\n") | |
| for art in soup.find_all("h2", class_="story-heading"): |