Skip to content

Instantly share code, notes, and snippets.

View KakoozaJerry's full-sized avatar
🎯
Focusing

KakoozaJerry

🎯
Focusing
View GitHub Profile
# 1 - Import library
import pygame
from pygame.locals import *
import math
import random
# 2 - Initialize the game
pygame.init()
width, height = 640, 480
screen=pygame.display.set_mode((width, height))
theBoard = {'7': ' ' , '8': ' ' , '9': ' ' ,
'4': ' ' , '5': ' ' , '6': ' ' ,
'1': ' ' , '2': ' ' , '3': ' ' }
board_keys = []
for key in theBoard:
board_keys.append(key)
const firstArray = [4, 9, 5];
const secondArray = [9,4,9,8,4];
let intersection = firstArray.filter((el) => { return secondArray.includes(el); });
console.log(intersection)
var numbers = [1,3,3,4,4,4]
function countDuplicate(numbers){
//write your code here
//var result = {}
var result = {}
numbers.forEach(function(x){
result[x] = (result[x] || 0) + 1;
});
numbers.filter((item,x)=>numbers.indexOf(item)==x)
function countDuplicates(numbers){
//[1,1,1,2,3,3,4,5,6]
//[1,3,1,4,5,1,6,3,2]
numbers.sort((a,b) => a - b)
// sort the array
let count = 0
let left = 0
let right = 1
//loop through numbers
while (right < numbers.length){
/**
* @param {number[]} nums1
* @param {number[]} nums2
* @return {number}
*/
let totals = (garray) => {
let count = 0;
for (let i=0; i < garray.length; i++){
let result = garray[i];
/**
* @param {number[]} nums
* @param {number} target
* @return {number[]}
*/
var twoSum = function(nums, target) {
let numsObj = new Map()
for(let i=0;i<nums.length;i++){
let num = nums[i];
// Returns the first character of the string str
var firstCharacter = function(str) {
return str.slice(0, 1);
};
// Returns the last character of a string str
var lastCharacter = function(str) {
return str.slice(-1);
};
const mysql = require("mysql");
const Json2csvParser = require("json2csv").Parser;
const fs = require("fs");
// Create a connection to the database
const connection = mysql.createConnection({
host: "localhost",
user: "***********",
password: "*******",
database: "*******"
try:
from xml.etree.cElementTree import XML
except ImportError:
from xml.etree.ElementTree import XML
import os
import re
import pathlib
import zipfile