Skip to content

Instantly share code, notes, and snippets.

Avatar
🌗
Working from home

Essa Mamdani essamamdani

🌗
Working from home
View GitHub Profile
@essamamdani
essamamdani / pygame.py
Created May 15, 2020
displaying image
View pygame.py
import pygame
pygame.init()
displayWidth = 800
displayHeight = 600
surface= pygame.display.set_mode((displayWidth, displayHeight ))
pygame.display.set_caption('Image')
displayImage = pygame.image.load(r'C:\Users\user\Pictures\image.jpg')
while True :
surface.fill((255,255,255))
@essamamdani
essamamdani / tuple.py
Created May 11, 2020
iterating through list of tuples
View tuple.py
tuple_list = [(1,2,3), (4,5,6), (7,8,9)]
for triple in tuple_list:
print(triple)
@essamamdani
essamamdani / zip_longest.py
Created May 11, 2020
zip method using longest property
View zip_longest.py
import itertools
lst1 = [1,2,3,4,5]
lst2=["banana","apple","mango","berry"]
lst3=["black","red"]
for (a, b, c) in itertools.zip_longest(lst1, lst2, lst2):
print (a, b, c)
@essamamdani
essamamdani / multiVariables.py
Created May 11, 2020
iterating lists through multi-variables
View multiVariables.py
import itertools
lst1 = [1,2,3,4,5]
lst2=["banana","apple","mango","berry"]
lst3=["black","red"]
for (a, b, c) in zip(lst1, lst2, lst3):
print (a, b, c)
@essamamdani
essamamdani / listVaraibles.py
Created May 11, 2020
iterates over multiple lists through one variable.
View listVaraibles.py
import itertools
lst1 = [1,2,3,4,5]
lst2=["banana","apple","mango","berry"]
lst3=["black","red"]
for (a) in zip(lst1, lst2, lst3):
print (a)
View IterationPython.py
lst1 = [1,2,3,4,5]
for x in lst1:
print (x)
View lengthSet.js
var setA = new Set();
setA.add("maps").add("filters").add("generators").add("arrow functions");
console.log(setA.size);
@essamamdani
essamamdani / functionsInSet.js
Created Apr 27, 2020
different operations of set
View functionsInSet.js
var new_js = new Set(["Maps", "functions" , "filters" , "generators" , "loops"])
var old_js = new Set(["functions" , "var" , "loops" , "this"])
union(new_js, old_js)
intersection(new_js, old_js)
difference(new_js, old_js)
function union(new_js, old_js) {
var js = new Set(old_js)
for(var item of new_js) {
View ArrayAndSet.js
var arr = ["functions", "this" , "var" , "const" , "functions" , "var"]
var refinedArr = new Set(arr)
console.log(refinedArr)
arr = [...refinedArr]
console.log(arr)
@essamamdani
essamamdani / IteratSet.js
Created Apr 27, 2020
iterating sets through arrow function
View IteratSet.js
ar setA = new Set();
setA.add(“maps”);
setA.add("maps").add("filters").add("generators").add("arrow functions");
setA.forEach(set => {
document.write(set + "<br/>")
})