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. Create a function with a loop that prints out only the odd positioned elements of an array that it takes in. | |
| var myArray = ["Carl", "Addison", "Alex", "Marshall", "Nancy", "Tryana", "Peter"] | |
| // Iterates through array and prints out only oddly-positioned numbers | |
| for (i=0; i<myArray.length; i++) { | |
| if ( i % 2 == 1) { | |
| console.log(myArray[i]); | |
| } | |
| 2. Create a function with a loop that prints out only the even numbers of an array that consists of only numbers. |
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/python | |
| import curses | |
| import random | |
| stdscr = curses.initscr() | |
| curses.noecho() | |
| curses.cbreak() | |
| stdscr.keypad(1) | |
| curses.halfdelay(1) |