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 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)) |
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
| tuple_list = [(1,2,3), (4,5,6), (7,8,9)] | |
| for triple in tuple_list: | |
| print(triple) |
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 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) |
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 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) |
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 itertools | |
| lst1 = [1,2,3,4,5] | |
| lst2=["banana","apple","mango","berry"] | |
| lst3=["black","red"] | |
| for (a) in zip(lst1, lst2, lst3): | |
| print (a) |
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
| lst1 = [1,2,3,4,5] | |
| for x in lst1: | |
| print (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
| var setA = new Set(); | |
| setA.add("maps").add("filters").add("generators").add("arrow functions"); | |
| console.log(setA.size); |
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
| 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) { |
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
| var arr = ["functions", "this" , "var" , "const" , "functions" , "var"] | |
| var refinedArr = new Set(arr) | |
| console.log(refinedArr) | |
| arr = [...refinedArr] | |
| console.log(arr) |
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
| ar setA = new Set(); | |
| setA.add(“maps”); | |
| setA.add("maps").add("filters").add("generators").add("arrow functions"); | |
| setA.forEach(set => { | |
| document.write(set + "<br/>") | |
| }) |
NewerOlder