Skip to content

Instantly share code, notes, and snippets.

View wmantly's full-sized avatar

William Mantly wmantly

View GitHub Profile
#!/usr/bin/python3
class Node:
def __init__( self, data , point ):
self.data = data
self.point = point
class LinkedList:
#!/usr/bin/python3
class Node:
def __init__( self, data , point ):
self.data = data
self.point = point
class LinkedList:
#!/usr/bin/python3
from numbers import Number
def binary_search( search, match ):
if len( search ) < 10:
print(search)
for i in search:
print(i)
denominations_USD = [
{ 'title': 'Hundred-dollar bill', 'count': 0, 'val': 10000 },
{ 'title': 'Fifty-dollar bill', 'count': 0, 'val': 5000 },
{ 'title': 'Ten-dollar bill', 'count': 0, 'val': 1000 },
{ 'title': 'Five-dollar bill', 'count': 0, 'val': 500 },
{ 'title': 'One-dollar bill', 'count': 0, 'val': 100 },
{ 'title': 'Quarter', 'count': 0, 'val': 25 },
{ 'title': 'Dime', 'count': 0, 'val': 10 },
{ 'title': 'Nickel', 'count': 0, 'val': 5 },
{ 'title': 'penny', 'count': 0, 'val': 1 }
class my_int( int ):
def roman( self ):
romanNum = []
symbols = ( ( 'M', 1000 ), ( 'C', 100 ), ( 'XC', 90 ), ( 'L', 50), ( 'X', 10 ),
( 'IX', 9 ), ('V', 5) , ( 'IV', 4 ), ( 'I', 1 ) )
for symbol, value in symbols:
while self >= value:
self -= value
romanNum.append( symbol )
class Ceasar( str ):
def __shiftLetter( self, letter, shift ):
letter_code = ord( letter )
shift = int( shift )
if letter.islower():
base = ord( 'a' )
last = ord( 'z' )
else:
base = ord( 'A' )
1. Pure Javascript
Create a StringParser class that takes a string as constructor argument.
A StringParser instance must provide the following :
● Get the number of occurrences of a given character
● Get the characters with the most/least occurrences
● Be able to work in case insensitive mode (if needed).
Bonus points if:
● The methods can also be called directly without building a StringParser object (eg by
calling StringParser.prototype.xxx...)
● The methods can somehow also work on other array­like objects (eg arrays,
class Ceasar( str ):
def __shiftLetter( self, letter, shift ):
letter_code = ord( letter )
shift = int( shift )
if letter.islower():
base = ord( 'a' )
last = ord( 'z' )
else:
base = ord( 'A' )
class roman_int( int ):
def roman( self ):
romanNum = []
symbols = ( ( 'M', 1000 ), ( 'C', 100 ), ( 'XC', 90 ), ( 'L', 50 ), ( 'X', 10 ),
( 'IX', 9 ), ('V', 5 ) , ( 'IV', 4 ), ( 'I', 1 ) )
for symbol, value in symbols:
while self >= value:
self -= value
romanNum.append( symbol )
sqlite> .schema
CREATE TABLE `users` (
`id` INTEGER,
`name` VARCHAR,
`email` VARCHAR,
`city` VARCHAR,
`state` VARCHAR,
`last_visit` DATE,
`page_views` INTEGER,
PRIMARY KEY (`id`)