-
Posts
6033 -
Joined
-
Last visited
-
Days Won
23
Content Type
Profiles
News
Forums
Blogs
Gallery
Events
Everything posted by CoderDrag0n8
-
What should you do if someone tells you they survived the Boston Massacre?
SpoilerLaugh in their face.
Spoilerfor your information, 6 people died. Literally 6. Yeah sure, 'massacre'
-
I have decided
Politics is stupid.
and so
I have decided
to be Squirclist
the political party that thinks politics is stupid
-
// list {list} list that is being searched // index {var} variable that the list is being searched for // return {num} index of the variable that was searched for, if index did not exist in list, then it outputs the length of the list function backwardsList(list, index){ var backwardsOutput = list.length; for(var i=0;i<list.length;i++){ if (backwardsOutput==list[i]){ backwardsOutput = i; } } if (backwardsOutput==list.length) { console.log("No index found - backwardsList " + index); } return backwardsOutput; } // string {string} the input string // return {list} a list of all the individual words function splitStringSpaces(string){ var list = []; var singleWord = ""; var fullString = string + " "; for(var i=0; i<fullString.length; i++){ if (fullString[i]==" "){ appendItem(list, singleWord); singleWord = ""; } else { singleWord = singleWord + fullString[i]; } } return list; }
Just some code I made
def backwardsList(forwardsList, index): backwardsListOutput = "Not found" for i in forIndex(forwardsList): if (forwardsList[i]==index): backwardsListOutput = i if (backwardsListOutput=="Not found"): print(backwardsListOutput) backwardsListOutput = len(forwardsList) return backwardsListOutput def forIndex(indexList): return range(len(indexList))
This python one doesn't have splitStringSpaces, because I was to lazy, but it does have forIndex (In an attempt to make for loops easier in python, they are honestly better in javascript (Python loops are sometimes easier, but it isn't too hard to set up a javascript for loop that does basically the same thing, but trying to make a javascript for loop in python is just a pain)).
The python one also doesn't have comments, I'm too lazy to make them.
-
-
NERDSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
(sorry i needed to get that out)
gosh ryn is a great friend
