View eratosthenes.py
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 degree | |
def main(): | |
print("------------------------") | |
print("| codedrome.com |") | |
print("| Eratosthenes and the |") | |
print("| Size of Planet Earth |") | |
print("------------------------\n") |
View degree.py
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 Degree(object): | |
def __init__(self, degrees = 0, minutes = 0, seconds = 0): | |
self._seconds = self._seconds_from_dms(degrees, minutes, seconds) | |
def __str__(self): | |
dms = self.get() |
View baconscipherdemo.py
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 baconscipher | |
def main(): | |
print("------------------") | |
print("| codedrome.com |") | |
print("| Bacon's Cipher |") | |
print("------------------\n") |
View baconscipher.py
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 encipher(plaintext, target_text): | |
""" | |
Encipher plaintext to target text with binary 0 | |
as lower case and binary 1 as upper case | |
""" | |
# remove all non-alphabetic characters | |
# from plaintext and convert to upper case | |
plaintext = ''.join([c for c in plaintext if c.isalpha()]).upper() |
View quadrilateralareascoordinatesmain.py
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 quadrilateralareascoordinates | |
def main(): | |
print("-----------------------------------") | |
print("| codedrome.com |") | |
print("| Calculating Areas of |") | |
print("| Quadrilaterals from Coordinates |") | |
print("-----------------------------------\n") |
View quadrilateralareascoordinates.py
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 calculate_area(c): | |
''' | |
Calculates the area of any quadrivaletral | |
from a list of x,y coordinates in the following format: | |
[[x1,y1],[x2,y2],[x3,y3],[x4,y4]] | |
''' | |
first = c[0][0]*c[1][1] + c[1][0]*c[2][1] + c[2][0]*c[3][1] + c[3][0]*c[0][1] |
View bretschneidersformulamain.py
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 bretschneiderformula | |
def main(): | |
print("---------------------------------------") | |
print("| codedrome.com |") | |
print("| Calculating Areas of Quadrilaterals |") | |
print("| With Bretschneider's Formula |") | |
print("---------------------------------------\n") |
View bretschneidersformulamain.py
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 functools import reduce | |
import math | |
def calculate_area(sides, opposite_angles_degrees): | |
''' | |
Calculate the area of a quadrilateral using Bretschneider's Formula | |
from the lengths of the sides and either pair of OPPOSITE angles. | |
Arguments:- |
View bretschneidersformula.py
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 functools import reduce | |
import math | |
def calculate_area(sides, opposite_angles_degrees): | |
''' | |
Calculate the area of a quadrilateral using Bretschneider's Formula | |
from the lengths of the sides and either pair of OPPOSITE angles. | |
Arguments:- |
View quadrilateralareasmain.py
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 quadrilateralareas | |
def main(): | |
print("---------------------------") | |
print("| codedrome.com |") | |
print("| Areas of Quadrilaterals |") | |
print("---------------------------\n") |
NewerOlder