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
# Python 3 script to convert Arabic numerals to Roman numerals. | |
# which = input("To arabic or roman numerals? ") | |
which = "arabic" # currently only works for conversion to roman numerals | |
if which == "arabic": # placeholder | |
arabic = input("Input your arabic numeral: ") # prompt user | |
arabicArray = list(arabic) # [1,2,3,4] represents 1000 + 200 + 30 + 4... How do I make this list a list of ints? | |
romanArray = [] # fill later | |
for dig in range((len(arabicArray)-1),-1,-1): # iterate backwards |
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 init_(): # Initializes the program | |
startup = input("Encode or decode with key or decode without key? (ed/dwok)\n> ").lower() | |
if startup == "dwok": # "dwok" means decode without key. | |
caesar_cipher_hiddenkey_decode() | |
elif startup == "ed": # "ed" means encode/decode. | |
caesar_cipher() | |
else: | |
print("It looks like you didn't input ed or dwok. Try again please.") | |
startup_() |
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
initialize Deck class | |
Deck shuffle method | |
Has array of all cards | |
Makes new array of cards and appends random index value of cards in former array into new array | |
Deck removecard method | |
Pop a single card from the array of all cards | |
Deck givecard method |
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
function Card(val,st) { | |
this.value = val; | |
this.suit = st; | |
} | |
Card.prototype.getValue = function() { | |
return this.value; | |
} | |
Card.prototype.getSuit = function() { |
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
function Node(c,n) { | |
this.content = c || null; | |
this.nextNode = n || null; | |
} | |
Node.prototype.getContent = function() { | |
return this.content; | |
} | |
Node.prototype.setContent = function(c) { |
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
/* | |
Last in, first out linked list. | |
Stack | |
- top | |
+ push | |
+ pop | |
+ peek | |
+ getLength | |
+ isEmpty | |
*/ |
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
<!--Good luck using this--> | |
<!--Credit to BC (and Colin Roberts for the sliding effect. Thanks Colin.) Made some alterations myself to suit Stacks--> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Stack runner</title> | |
<style> | |
* { | |
margin: 0px; | |
padding: 0px; |
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
function Queue() { | |
this.length = 0; // I chose this over a for loop in the method getLength because I thought it might be faster. I think the trade off here is that it adds one extra step every dequeue and enqueue rather than spending n steps every method call for getLength. | |
this.head = null; | |
this.tail = null; | |
} | |
Queue.prototype.enqueue = function(n) { | |
if(this.length > 0) { | |
this.tail.setNextNode(n); | |
this.tail = n |
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
Node.prototype.setNextNode = function(n) { | |
this.nextNode = n; | |
} |
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
if true | |
puts 'This is true' | |
end | |
else | |
puts 'This is false' | |
end |
OlderNewer