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
| // returns a dictionary that holds the indexes for every character in a string | |
| func StringIndexer(str:String) ->Dictionary<Int, Character> { | |
| var strlist = Array(str); var strdict = [Int:Character](); var indexer = 0 | |
| for letter in strlist { | |
| strdict.updateValue(letter, forKey: indexer) | |
| indexer += 1 | |
| } | |
| return strdict | |
| } | |
| // returns an array containing the indexes where a character appears in a string |
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
| // Returns a slice of an array that contains characters | |
| func StringSlicer(list:Array<Character>, n1:Int, n2:Int) ->Array<Character> { | |
| var slicer = n1; var slicedlist = [Character]() | |
| while slicer <= n2 { | |
| slicedlist.append(list[slicer]) | |
| slicer += 1 | |
| } | |
| return slicedlist | |
| } | |
| // returns a slice of an array of characters with an increment |
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
| // returns a dictionary that holds the indexes for every character in a string | |
| func StringIndexer(str:String) ->Dictionary<Int, Character> { | |
| var strlist = Array(str); var strdict = [Int:Character](); var indexer = 0 | |
| for letter in strlist { | |
| strdict.updateValue(letter, forKey: indexer) | |
| indexer += 1 | |
| } | |
| return strdict | |
| } | |
| // returns an array containing the indexes where a character appears in a string |
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
| //counts a specific letter in a string | |
| func SpecificLetterCount(str:String, char:Character) ->Int { | |
| var letters = Array(str); var count = 0 | |
| for letter in letters { | |
| if letter == char { | |
| count += 1 | |
| } | |
| } | |
| return count | |
| } |
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 Node (object): | |
| def __init__(self, cargo=0, next=0): | |
| self.cargo, self.next = cargo, next | |
| class NodeList (list): | |
| def __init__(self, head): | |
| self.append(head) | |
| def deeplen(self): | |
| strlst = list(str(self)) | |
| numlist = [s for s in strlst if s != '[' and s != ']' and s != ' ' and s != ','] |
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 Link (object): | |
| def __init__(self, first=None, rest=None): | |
| self.first = first | |
| self.rest = rest | |
| def get_data(self): | |
| return self.first | |
| def get_next(self): | |
| return self.rest | |
| def __getitem__(self, 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
| package tester; | |
| import java.applet.*; | |
| import java.awt.*; | |
| public class list_applet extends Applet{ | |
| public void init(){ | |
| System.out.print ("Peace Out"); | |
| } | |
| public void paint(Graphics g){ |
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
| import java.awt.*; | |
| import java.awt.event.*; | |
| import java.applet.*; | |
| public class textfield extends Applet implements ActionListener { | |
| TextField inputLine = new TextField(15); | |
| public textfield() { | |
| add(inputLine); | |
| inputLine.addActionListener(this); |
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
| import java.util.Arrays; | |
| class Main { | |
| public static void main(String[] args) { | |
| int[] thing = {1, 2, 3}; | |
| System.out.println(Arrays.toString(thing)); | |
| } | |
| } |
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
| import java.util.Arrays; | |
| class Main { | |
| public static void main(String[] args) { | |
| System.out.println(checkvalue(thing, 2)); | |
| } | |
| static int[] thing = {1, 2, 3}; | |
| static int checkvalue(int[] x, int y) { | |
| return x[y]; | |
| } |
OlderNewer