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
""" | |
Counts the number of colorings possible if n walls are colored with n colors. Also partitions the set of all colors by the number of colors used. | |
Uses itertools product function to comtrol the number of nested for loops. The itertools library | |
contains functions for creating iterators for efficient looping. | |
See: | |
https://docs.python.org/3/library/itertools.html#itertools.product | |
for detailed documentation. | |
""" |
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
""" | |
Vince list rewritten to use itertools product function. This calculates the cartesian product of input iterables. It operates like nested for loops. | |
See: | |
https://docs.python.org/3/library/itertools.html#itertools.product | |
for detailed documentation. | |
My goal is too generalize the count to n colors. | |
""" |
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
""" | |
quickWeather.py - Prints the weather for a location from the command line. | |
A program from Automate the Boring Stuff | |
I reworked it so that it finds the weather from the location assigned to the | |
location variable. The code for running the program from the command line is | |
commented out. | |
""" | |
import json, requests, sys |
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 webbrowser | |
# import requests, os, bs4 | |
# webbrowser.open('http://inventwithpython.com/') | |
#! python3 | |
# lucky.py - Opens several Google search results. | |
import requests, sys, webbrowser, bs4 |
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 re | |
""" | |
This program demonstrates two regexes: one for matching vowels and one for matching social socurity numbers (SSN's'). The program requests some text from the user to use to demo the vowel matching. For the SSN matching, the text assigned to text3 is searched for SSN's. | |
""" | |
print('Input some text.\n') | |
text = input() | |
# A regex for matching vowels. | |
vowelRegex = re.compile(r'[aeiouAEIOU]') | |
mo = vowelRegex.findall(text) |
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
""" | |
This program searches the text in a file for | |
email addresses and phone numbers. It copies | |
them to a list called matches and prints them | |
them neatly amd in a standard format. | |
This a slight midification of a progtam found at https://automatetheboringstuff.com/chapter7/ | |
See also the documentstion at Python.org for the re library (regular expressions operations) here https://docs.python.org/3/library/re.html#re.ASCII | |
""" | |
import re |
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
""" | |
This program searches the text in a file for | |
email addresses and phone numbers. It copies | |
them to a list called matches and prints them | |
them neatly amd in a standard format. | |
This a slight midification of a progtam found at https://automatetheboringstuff.com/chapter7/ | |
See also the documentstion at Python.org for the re library (regular expressions operations) here https://docs.python.org/3/library/re.html#re.ASCII | |
""" | |
import re |
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 tkinter import * | |
import time | |
gui = Tk() | |
gui.title('Animation Test') | |
gui.geometry('400x400') | |
c = Canvas(gui ,width=400 ,height=400) | |
c.pack() | |
oval = c.create_oval(5,5,60,60,fill='pink') | |
xd = 5 | |
yd = 10 |
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
# We will demonstrate the Law of Large Numbers by simulating die rolls. As the number of die rolls increases the relative frequency of each number should aprroach the theoretical probability of 1/6. | |
# We will use the function randint from the random library. The function is described below. | |
from random import randint | |
# The function randint(1,6) simulates a die roll by returning a random integer between 1 and 6. | |
# Roll a die once. | |
print('We rolled a die once and roll a %i.\n' % (randint(1,6))) |
NewerOlder