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
| #!/usr/bin/python3 | |
| class Node: | |
| def __init__( self, data , point ): | |
| self.data = data | |
| self.point = point | |
| class LinkedList: |
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
| #!/usr/bin/python3 | |
| class Node: | |
| def __init__( self, data , point ): | |
| self.data = data | |
| self.point = point | |
| class LinkedList: |
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
| #!/usr/bin/python3 | |
| from numbers import Number | |
| def binary_search( search, match ): | |
| if len( search ) < 10: | |
| print(search) | |
| for i in search: | |
| print(i) |
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
| 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 } |
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
| 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 ) |
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
| 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' ) |
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
| 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 arraylike objects (eg arrays, |
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
| 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' ) |
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
| 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 ) |
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
| sqlite> .schema | |
| CREATE TABLE `users` ( | |
| `id` INTEGER, | |
| `name` VARCHAR, | |
| `email` VARCHAR, | |
| `city` VARCHAR, | |
| `state` VARCHAR, | |
| `last_visit` DATE, | |
| `page_views` INTEGER, | |
| PRIMARY KEY (`id`) |