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]; | |
| } |
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(Arrays.toString(setvalue(thing, 2, 50))); | |
| } | |
| static int[] thing = {1, 2, 3}; | |
| static int[] setvalue(int[] x, int y, int z) { | |
| x[y] = z; | |
| return x; |
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(Arrays.toString(range(4))); | |
| } | |
| static int[] range(int x) { | |
| int [] range = new int[x]; | |
| int num = 0; | |
| while (num < x) { |
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(Arrays.toString(reverserange(4))); | |
| } | |
| static int[] reverserange(int x) { | |
| int [] range = new int[x]; | |
| int num = x; | |
| int counter = 0; |
OlderNewer