Skip to content

Instantly share code, notes, and snippets.

View eratosthenes.py
import degree
def main():
print("------------------------")
print("| codedrome.com |")
print("| Eratosthenes and the |")
print("| Size of Planet Earth |")
print("------------------------\n")
View degree.py
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
import baconscipher
def main():
print("------------------")
print("| codedrome.com |")
print("| Bacon's Cipher |")
print("------------------\n")
View baconscipher.py
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()
@CodeDrome
CodeDrome / quadrilateralareascoordinatesmain.py
Created Mar 30, 2022
quadrilateralareascoordinatesmain.py
View quadrilateralareascoordinatesmain.py
import quadrilateralareascoordinates
def main():
print("-----------------------------------")
print("| codedrome.com |")
print("| Calculating Areas of |")
print("| Quadrilaterals from Coordinates |")
print("-----------------------------------\n")
@CodeDrome
CodeDrome / quadrilateralareascoordinates.py
Created Mar 30, 2022
quadrilateralareascoordinates.py
View quadrilateralareascoordinates.py
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
import bretschneiderformula
def main():
print("---------------------------------------")
print("| codedrome.com |")
print("| Calculating Areas of Quadrilaterals |")
print("| With Bretschneider's Formula |")
print("---------------------------------------\n")
@CodeDrome
CodeDrome / bretschneidersformulamain.py
Created Mar 28, 2022
bretschneidersformulamain.py
View bretschneidersformulamain.py
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
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:-
@CodeDrome
CodeDrome / quadrilateralareasmain.py
Created Mar 25, 2022
quadrilateralareasmain.py
View quadrilateralareasmain.py
import quadrilateralareas
def main():
print("---------------------------")
print("| codedrome.com |")
print("| Areas of Quadrilaterals |")
print("---------------------------\n")