Snippets Collections
>>> from operator import add
>>> list( map(add, list1, list2) )
[5, 7, 9]
class Parent(object):
      def implicit(self):
          print("PARENT implicit()")

class Child(Parent):
      pass
    dad = Parent()
    son = Child()
    
    dad.implicit()
    son.implicit()
x=[]
y=[]
for key, value in genres.items():
    x.append(key)
    y.append(value)
for key in sorted(my_dict, key=my_dict.get):

    print('{} : {}'.format(key, my_dict[key]))
from csv import reader
fp = open('amazon_jobs_dataset.csv', encoding='utf-8')
data = list(reader(fp))
fp.close()
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
>>> matches = re.findall(f'(?:{p})+', s)
>>> matches
['HELLO', 'HELLO', 'HELLOHELLOHELLO', 'HELLOHELLO']

>> max(map(len, matches)) // len(p)
3
from setuptools import setup, find_packages

setup(
  name="package-name",
  version="0.0.0",
  packages=find_packages(),
  entry_points = {
    'console_scripts':
      ["command = package_name.module_name:function_name"],
    },
)
and
or
not
!=(not equal)
==(equal)
>=(greater-than-equal)
<=(less-than-equal)
True
False
>>> format(integer, '0>42b')
'001010101111000001001000111110111111111111'
def mlm_loss(y_true, y_pred):
loss=float(0)
a = tf.keras.backend.constant(1, dtype='float32')
for s in range(batch_size): # for each sample in batch
    for i in range(L):
        for j in range(L):
            loss=loss + y_true[s][i]*(a-y_true[s][j])*(a-(y_pred[s][i]-y_pred[s][j])) #two conditions
l= tf.keras.backend.constant(L, dtype='float32')            
loss=a/l*loss           
return loss
def add(a, b):
    print(f"ADDING {a} + {b}")
    return a + b
  
def subtract(a, b):
    print(f"SUBTRACTING {a} - {b}")
    return a - b
# this is like your scripts with argv
def print_two(args):
    arg1, arg2 = args
    print(f"arg1:{arg1}, arg2: {arg2}")
 
# this just takes one argument
def print_one(arg1):
    print(f"arg1:{arg1}")
    
# this one takes no argument
def print_none():
     print?("I got nothin',")
from sys import argv
script, first, second = argv

print("The script is called:", script)
print("The first variable is:", first)
print("The second variable is:", second)
from sys import argv

script, filenames = argv

txt = open(filename)

print(f"Here's your life {filename}:")
print(txt.read())

print("Type the filename again:")
file_open = input(">")

txt_again = open(file_again)
print(txt_again.read())
print("How old are you?", end=' ')
age = input()
print("How tall are you?", end= ' ')
height = input()
print("How much do you weight?", end= ' ')
weight = input()

print(f"So, you're {age} old, {height} tall and {weight} heavy.")
from sys import argv
script, first, second

print("The script is called:", script)
print("your first variable is:", first)
print("your second variable is:, second)
formatter = "{} {} {} {}"

print(formatter.format(1, 2, 3, 4,))
print(formatter.format(one, two, three, four))
print(formatter.format(true, false, false, true))
end1 = "B"
end2 = "u"
end3 = "r"
end4 = "g"
end5 = "e"
end6 = "r"

print(end1 + end2 + end3 + end4 + end5)
A) Detect faces in Image file (using Python & OpenCV)



face_detect.py :
=================

import cv2

face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

img = cv2.imread('face.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)


faces = face_cascade.detectMultiScale(
    gray,
    scaleFactor=1.1,
    minNeighbors=5,
    minSize=(30, 30),
    flags = cv2.CASCADE_SCALE_IMAGE
)

print("Faces shape : ", faces.shape)

for (x,y,w,h) in faces:
    cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)

print("Face count : ", faces.shape[0])

cv2.imshow('img',img)
cv2.waitKey(0)
cv2.destroyAllWindows()


=====================================================================

B) Detect faces using Camera (using Python & OpenCV).


face_detect_cam.py :
====================
import cv2

face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

cap = cv2.VideoCapture(0)

while True:
	ret, img = cap.read();
	
	if not ret:
		break
		
	gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

	faces = face_cascade.detectMultiScale(
		gray,
		scaleFactor=1.1,
		minNeighbors=5,
		minSize=(30, 30),
		flags = cv2.CASCADE_SCALE_IMAGE
	)

	for (x,y,w,h) in faces:
		cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
	
	cv2.imshow('Face', img)
	
	key = cv2.waitKey(1)
	if key==27 or key==ord('q'):
		break;

cap.release()
cv2.destroyAllWindows()


types_of_people = 10
x = f"there are {types_of_people} types of people."

binary = "binary"
do_not = don't
y = f"those who know {binary} and those who {do_not}."
cars = 80
drivers = 40
passengers = 70

Print(cars)
# print this line
print("Hello world again")
In [1]: data = [
   ...:     {'id': '10', 'animal' : 'cat'},
   ...:     {'id': '11', 'animal' : 'dog'},
   ...:     {'id': '3', 'animal' : 'pigeon'},
   ...:     {'id': '10', 'color' : 'yellow'},
   ...:     {'id': '11', 'color' : 'brown'},
   ...:     {'id': '3', 'color' : 'grey'},
   ...:     {'id': '10', 'type' : 'furry'},
   ...:     {'id': '11', 'type' : 'fluffy'},
   ...:     {'id': '3', 'type' : 'dirty'},
   ...: ]

In [2]: from collections import defaultdict
   ...: ids = defaultdict(dict)
   ...: for d in data:
   ...:     ids[d["id"]].update(d)
   ...:


In [6]: list(ids.values())
Out[6]:
[{'id': '10', 'animal': 'cat', 'color': 'yellow', 'type': 'furry'},
 {'id': '11', 'animal': 'dog', 'color': 'brown', 'type': 'fluffy'},
 {'id': '3', 'animal': 'pigeon', 'color': 'grey', 'type': 'dirty'}]
d = dict.fromkeys(df.select_dtypes(object).columns, 0)
df = df.assign(**d)
class MyModel(models.Model):
        field1 = models.CharField(max_length=40, blank=False, null=False)
        field2 = models.CharField(max_length=60, blank=True, null=True)
# Open a file: file
file = open('my_text_file',mode='r')
 
# read all lines at once
all_of_it = file.read()
 
# close the file
file.close()
import ast
l = ast.literal_eval('[ "A","B","C" , " D"]')
l = [i.strip() for i in l]
from datetime import datetime, timedelta

d = datetime.today() - timedelta(days=days_to_subtract)
def toDate(dateString): 
    return datetime.datetime.strptime(dateString, "%Y-%m-%d").date()

@app.route()
def event():
    ektempo = request.args.get('start', default = datetime.date.today(), type = toDate)
    ...
from datetime import date
from dateutil.rrule import rrule, DAILY

a = date(2009, 5, 30)
b = date(2009, 6, 9)

for dt in rrule(DAILY, dtstart=a, until=b):
    print dt.strftime("%Y-%m-%d")
# result and path should be outside of the scope of find_path to persist values during recursive calls to the function
result = []
path = []
from copy import copy

# i is the index of the list that dict_obj is part of
def find_path(dict_obj,key,i=None):
    for k,v in dict_obj.items():
        # add key to path
        path.append(k)
        if isinstance(v,dict):
            # continue searching
            find_path(v, key,i)
        if isinstance(v,list):
            # search through list of dictionaries
            for i,item in enumerate(v):
                # add the index of list that item dict is part of, to path
                path.append(i)
                if isinstance(item,dict):
                    # continue searching in item dict
                    find_path(item, key,i)
                # if reached here, the last added index was incorrect, so removed
                path.pop()
        if k == key:
            # add path to our result
            result.append(copy(path))
        # remove the key added in the first line
        if path != []:
            path.pop()

# default starting index is set to None
find_path(di,"location")
print(result)
# [['queryResult', 'outputContexts', 4, 'parameters', 'DELIVERY_ADDRESS_VALUE', 'location'], ['originalDetectIntentRequest', 'payload', 'inputs', 0, 'arguments', 0, 'extension', 'location']]
>>> from sklearn.metrics import f1_score
>>> y_true = [0, 1, 2, 0, 1, 2]
>>> y_pred = [0, 2, 1, 0, 0, 1]
>>> f1_score(y_true, y_pred, average='macro')
0.26...
>>> f1_score(y_true, y_pred, average='micro')
0.33...
>>> f1_score(y_true, y_pred, average='weighted')
0.26...
>>> f1_score(y_true, y_pred, average=None)
array([0.8, 0. , 0. ])
>>> y_true = [0, 0, 0, 0, 0, 0]
>>> y_pred = [0, 0, 0, 0, 0, 0]
>>> f1_score(y_true, y_pred, zero_division=1)
1.0...
   >>> x = 20 # x is a variable
  
  >>> if x < 50: # if condition
  ...    print('(first suite)')
  ...    print('x is small')
  ... else: else condition
  ...    print('(second suite)')
  ...    print('x is large')
  ...
 (first suite)
 x is small
                                
                                
keys, values)) # {'a': 2, 'c': 4, 'b': 3}
 
 
#make a function: def is the keyword for the function:
def to_dictionary(keys, values):
 
 
#return is the keyword that tells program that function has to return value   
return dict(zip(keys, values))
 
  
 
# keys and values are the lists:
 
keys = ["a", "b", "c"]   
 
values = [2, 3, 4]
                                
                                
People = 30
Cars = 40
Trucks = 14
# line 1,2,3 assign the value to variables
If cars > people: Using if statement
  Print(“we should take the  cars.”)
Elif cars < people: if 1st is false execute elif
  print(“we should not take the car.”)
else : # if both are false then execute else:
    print(“we can’t decide.”)
                               
                                
People = 20
Cats = 30
Dogs = 15
# line 1,2 and 3 assigning values to variables 
If people < cats: #1st condition
print(“too many cats”)
If people > cats: #2nd condition
print(“not many cats.”) # 3rd condition
If people > dogs:
print(“ the world is dry.”)
                              
                                
x = int(input("Please enter an integer: "))
Please enter an integer: 42 #getting input from user
>>> if x < 0: #1st condition
...    x = 0
...    print('Negative changed to zero')
... elif x == 0: #2nd condition
...    print('Zero')
... elif x == 1: #3rd condition
...    print('Single')
... else: #4th condition
...    print('More')                               
                                
# a characters list
          1.characters = ['a', 'b', 'c', 'd', 'e', 'f']
          2.characters.clear()
                                
                                
# animals list
1.animals = ['cat', 'dog', 'rabbit']

# list of wild animals
2.wild_animals = ['tiger', 'fox']

# appending wild_animals list to the animals list
3.animals.append(wild_animals)

4.print('Updated animals list: ', animals)                                
                                
 Lucky_numbers = [“3”, “7”, “15”, “32”, “42”]                               
                                
 #declare two set the range
1.i = 1
2.j = 5
#use while loop for i
3.while i < 4:
#use while loop for j    
4.while j < 8:
        5.print(i, ",", j)
        6.j = j + 1
        7.i = i + 1
Output:
1 , 5
2 , 6
3 , 7                               
                                
1.# For-Else Syntax

2.for item in seq:
    3.statement 1
    4.statement 2
    5.if <cond>:
        6.break
7.Else:
8.Example:
     9.birds = ['Belle', 'Coco', 'Juniper', 'Lilly', 'Snow']
10.ignoreElse = False


11.for theBird in birds:
    12.print(theBird )
    13.if ignoreElse and theBird is 'Snow':
        14.break
15.else:
    16.print("No birds left.")
                              
                                
days = 0
week = [‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’, ‘Saturday’, 3.‘Sunday’]
while day < 7:
print(“Today is” + week[days])
days += 1
                                
                                
def minus_key(key, dictionary):

shallow_copy = dict(dictionary)

del shallow_copy[key]

return shallow_copy
                               
                                
>>> stuff = {‘name’ : ‘Zed’, ‘age’ : 39, ‘height’ : 6 * 12 +1}
>>. print(stuff [‘name’])
Zed
>>> print(stuff [‘age’])
39
>>> print(stuff [‘height’])
74
>>> stuff [‘city’] = “SF”
>>. print(stuff[‘city’])
SF
                                
                                
n = 2

s ="Programming"

print(s * n) # ProgrammingProgramming
def byte_size(string):

  return(len(string.encode('utf-8')))

byte_size('😀’) # 4
byte_size('Hello World') # 11
Use functools.reduce() to perform right-to-left function composition. The last (rightmost) function can accept one or more arguments; the remaining functions must be unary.
from functools import reduce

1.def compose(*fns):
  2.return reduce(lambda f, g: lambda *args: f(g(*args)), fns)
EXAMPLES
add5 = lambda x: x + 5
multiply = lambda x, y: x * y
multiply_and_add_5 = compose(add5, multiply)

multiply_and_add_5(5, 2) # 15
#define a function 
 Def cube(num)
      #write the formula of cube
      return num*num*num
     #give the number to calculate the cube 
     cube(3)
   # print the cube of that number simply by using print command
    print(cube(3))
     “return” keyword means that function have to return          value
 # give a name of function after def
 1.def sayhi():
      #put the statement in the function  
     2.print(“hello world”)
#call function by name:
3.sayhi()


Output: 
Hello world
# Program to add natural
# numbers upto 
# sum = 1+2+3+...+n

# To take input from the user,
# n = int(input("Enter n: "))

1.n = 10

# initialize sum and counter
2.sum = 0
3.i = 1

4.while i <= n:
   5. sum = sum + i
   6. i = i+1    # update counter

# print the sum
7.print("The sum is", sum)

When you run this code output will be:
Enter n: 10
The sum is 55
#define function
defall_unique(lst):

   return len(lst) == len(set(lst))
   
x = [1,1,2,2,3,2,3,4,5,6]


y = [1,2,3,4,5]


all_unique(x) # False
all_unique(y) # True
This method gets vowels (‘a’, ‘e’, ‘i’, ‘o’, ‘u’) found in a string.
   
#make a function:
def get_vowels(string):

#return is the keyword which means function have to return value: 
 return [each for each in string if each in 'aeiou']


#assign the words and function will return vowels words.
get_vowels('foobar') # ['o', 'o', 'a']


get_vowels('gym') # []
#use print command
1.print (“Mary had a little lamb.”)
2.print (“I am 19 years old.”)
def byte_size(string):




 return(len(string.encode('utf-8')))


  


 


byte_size('😀’) # 4
byte_size('Hello World') # 11
#define a function 
 1.Def cube(num)
      #write the formula of cube
      2.return num*num*num
     #give the number to calculate the cube 
     3.cube(3)
   # print the cube of that number simply by using print command
    4.print(cube(3))
     5.“return” keyword means that function have to return value         
 
def merge_two_dicts(a, b):
 
 
   c = a.copy()   # make a copy of a
 
   c.update(b)    # modify keys and values of a with the ones from b
 
   return c
 
 
 
 
 
a = { 'x': 1, 'y': 2}
 
b = { 'y': 3, 'z': 4}
 
 
print(merge_two_dicts(a, b)) # {'y': 3, 'x': 1, 'z': 4}
 
 
#make two lists:
1.num_list = [1, 2, 3]
2.alpha_list = ['a', 'b', 'c']

#use for loop for 1st list:
3.for number in num_list:
#print the list    
4.print(number)
#use for loop for @nd list:    
5.for letter in alpha_list:

# animals list
1.animals = ['cat', 'dog', 'rabbit', 'guinea pig']

# 'rabbit' is removed
2.animals.remove('rabbit')

# Updated animals List
3.print('Updated animals list: ', animals)
“Extend”  Allow to take a list and append another list at the end of it.
# language list
1.language = ['French', 'English', 'German']

# another list of language
2.language1 = ['Spanish', 'Portuguese']

3.language.extend(language1)

# Extended List
4.print('Language List: ', language)

When you run the program, the output will be:
Language List:  ['French', 'English', 'German', 'Spanish', 'Portuguese']
 1. var = 100 # var is a variable.
2.if var < 200:
   3.print "Expression value is less than 200"
   4.if var == 150:
      5.print "Which is 150"
   6.elif var == 100:
      7.print "Which is 100"
   8.elif var == 50:
      9.print "Which is 50"
   10.elif var < 50:
      11.print "Expression value is less than 50"
12.else:
   13.print "Could not find true expression"
 
14.print "Good bye!"
 
When the above code is executed, it produces following result −
Expression value is less than 200
Which is 100
Good bye!
#In computer programming, an iterator is an object that enables a programmer to traverse a container, particularly lists.
# define function:
1.def unfold(fn, seed):
  2.def fn_generator(val):
    3.while True: 
      4.val = fn(val[1])
     5.-5 if val == False: break
      6.yield val[0]
  7.return [i for i in fn_generator([None, seed])]
EXAMPLES
f = lambda n: False if n > 50 else [-n, n + 10]
unfold(f, 10) # [-10, -20, -30, -40,
month_conversion = {
“Jan” = “January”
“Feb” = “February”
“Mar” = “March”
“Apr” = “April”
“Jun” = “June”
}
# keys must be unique:
print(month_conversion[“Mar”])


Output”
           March
1.People = 30
2.Cars = 40
3. Trucks = 14
     # line 1,2,3 assign the value to variables
4.If cars > people: #Using if statement
   5.Print(“we should take the  cars.”)
6.Elif cars < people: #if 1st is false execute elif
     7.print(“we should not take the car.”)
8.else : # if both are false then execute else:
          9.print(“we can’t decide.”)
#assign a value to a variable:
types_of_people = 10 
# make a string using variable name:
X = f “there are {types_of_people} types of people.”

Output:
There are 10 types of people
  #use for loop and set the range
for index in range(10):
  Print (index)
           
           #when you run this program, the output will be:
               0 
               1 
               2 
               3 
               4 
               5
               6
               7
               8 
               9
                  

from summarizer import Summarizer

body = '''
your text body
'''

model = Summarizer()
result = model(body, min_length=120)
full = ''.join(result)
print(full)
pip install youtube-dl
youtube-dl --yes-playlist --write-auto-sub https://www.youtube.com/playlist?list=PLJ8cMiYb3G5czofUrrizDiyC_yNLOe_CF
listing = os.listdir(path) 
num_samples=size(listing)
print num_samples

for file in listing:
    im = Image.open(path1 + '/' + file)   
    img = im.resize((img_rows,img_cols))
    gray = img.convert('L')
    gray.save(path2 +'/' +  file, "PNG")
>>> int(3.7)
3

>>> int(-3.4)
-3

>>> int(round(3.8))
4
from datetime import datetime

datetime_object = datetime.strptime('Jun 1 2005  1:33PM', '%b %d %Y %I:%M%p')
def when(predicate, when_true):
  return lambda x: when_true(x) if predicate(x) else x
  
EXAMPLES
double_even_numbers = when(lambda x: x % 2 == 0, lambda x : x * 2)
double_even_numbers(2) # 4
double_even_numbers(1) # 1
def unfold(fn, seed):
  def fn_generator(val):
    while True: 
      val = fn(val[1])
      if val == False: break
      yield val[0]
  return [i for i in fn_generator([None, seed])]
  
  
EXAMPLES
f = lambda n: False if n > 50 else [-n, n + 10]
unfold(f, 10) # [-10, -20, -30, -40, -50]
from functools import reduce

def compose(*fns):
  return reduce(lambda f, g: lambda *args: f(g(*args)), fns)


EXAMPLES
add5 = lambda x: x + 5
multiply = lambda x, y: x * y
multiply_and_add_5 = compose(add5, multiply)

multiply_and_add_5(5, 2) # 15
import numpy as np

def pagerank(M, num_iterations=100, d=0.85):
    N = M.shape[1]
    v = np.random.rand(N, 1)
    v = v / np.linalg.norm(v, 1)
    iteration = 0
    while iteration < num_iterations:
        iteration += 1
        v = d * np.matmul(M, v) + (1 - d) / N
    return v
from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):
    def handle_starttag(self, tag, attrs):
        print("Encountered a start tag:", tag)
    def handle_endtag(self, tag):
        print("Encountered an end tag :", tag)
    def handle_data(self, data):
        print("Encountered some data  :", data)

parser = MyHTMLParser()
parser.feed('<html><head><title>Test</title></head>'
            '<body><h1>Parse me!</h1></body></html>')
           
def hanoi(n, source, helper, target):
    if n > 0:
        # move tower of size n - 1 to helper:
        hanoi(n - 1, source, target, helper)
        # move disk from source peg to target peg
        if source:
            target.append(source.pop())
        # move tower of size n-1 from helper to target
        hanoi(n - 1, helper, source, target)
        
source = [4,3,2,1]
target = []
helper = []
hanoi(len(source),source,helper,target)

print source, helper, target
    
Result:
    Move disk 1 from A to B
    Move disk 2 from A to C
    Move disk 1 from B to C
    Move disk 3 from A to B
    Move disk 1 from C to A
    Move disk 2 from C to B
    Move disk 1 from A to B
import re
import random
import os

# GLOBAL VARIABLES
grid_size = 81

def isFull (grid):
    return grid.count('.') == 0
  
# can be used more purposefully
def getTrialCelli(grid):
  for i in range(grid_size):
    if grid[i] == '.':
      print 'trial cell', i
      return i
      
def isLegal(trialVal, trialCelli, grid):

  cols = 0
  for eachSq in range(9):
    trialSq = [ x+cols for x in range(3) ] + [ x+9+cols for x in range(3) ] + [ x+18+cols for x in range(3) ]
    cols +=3
    if cols in [9, 36]:
      cols +=18
    if trialCelli in trialSq:
      for i in trialSq:
        if grid[i] != '.':
          if trialVal == int(grid[i]):
            print 'SQU',
            return False
  
  for eachRow in range(9):
    trialRow = [ x+(9*eachRow) for x in range (9) ]
    if trialCelli in trialRow:
      for i in trialRow:
        if grid[i] != '.':
          if trialVal == int(grid[i]):
            print 'ROW',
            return False
  
  for eachCol in range(9):
    trialCol = [ (9*x)+eachCol for x in range (9) ]
    if trialCelli in trialCol:
      for i in trialCol:
        if grid[i] != '.':
          if trialVal == int(grid[i]):
            print 'COL',
            return False
  print 'is legal', 'cell',trialCelli, 'set to ', trialVal
  return True

def setCell(trialVal, trialCelli, grid):
  grid[trialCelli] = trialVal
  return grid

def clearCell( trialCelli, grid ):
  grid[trialCelli] = '.'
  print 'clear cell', trialCelli
  return grid


def hasSolution (grid):
  if isFull(grid):
    print '\nSOLVED'
    return True
  else:
    trialCelli = getTrialCelli(grid)
    trialVal = 1
    solution_found = False
    while ( solution_found != True) and (trialVal < 10):
      print 'trial valu',trialVal,
      if isLegal(trialVal, trialCelli, grid):
        grid = setCell(trialVal, trialCelli, grid)
        if hasSolution (grid) == True:
          solution_found = True
          return True
        else:
          clearCell( trialCelli, grid )
      print '++'
      trialVal += 1
  return solution_found

def main ():
  #sampleGrid = ['2', '1', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '3', '1', '.', '.', '.', '.', '9', '4', '.', '.', '.', '.', '7', '8', '2', '5', '.', '.', '4', '.', '.', '.', '.', '.', '.', '6', '.', '.', '.', '.', '.', '1', '.', '.', '.', '.', '8', '2', '.', '.', '.', '7', '.', '.', '9', '.', '.', '.', '.', '.', '.', '.', '.', '3', '1', '.', '4', '.', '.', '.', '.', '.', '.', '.', '3', '8', '.']
  #sampleGrid = ['.', '.', '3', '.', '2', '.', '6', '.', '.', '9', '.', '.', '3', '.', '5', '.', '.', '1', '.', '.', '1', '8', '.', '6', '4', '.', '.', '.', '.', '8', '1', '.', '2', '9', '.', '.', '7', '.', '.', '.', '.', '.', '.', '.', '8', '.', '.', '6', '7', '.', '8', '2', '.', '.', '.', '.', '2', '6', '.', '9', '5', '.', '.', '8', '.', '.', '2', '.', '3', '.', '.', '9', '.', '.', '5', '.', '1', '.', '3', '.', '.']
  sampleGrid = ['.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '4', '6', '2', '9', '5', '1', '8', '1', '9', '6', '3', '5', '8', '2', '7', '4', '4', '7', '3', '8', '9', '2', '6', '5', '1', '6', '8', '.', '.', '3', '1', '.', '4', '.', '.', '.', '.', '.', '.', '.', '3', '8', '.']
  printGrid(sampleGrid, 0)
  if hasSolution (sampleGrid):
    printGrid(sampleGrid, 0)
  else: print 'NO SOLUTION'

  
if __name__ == "__main__":
    main()

def printGrid (grid, add_zeros):
  i = 0
  for val in grid:
    if add_zeros == 1:
      if int(val) < 10: 
        print '0'+str(val),
      else:
        print val,
    else:
        print val,
    i +=1
    if i in [ (x*9)+3 for x in range(81)] +[ (x*9)+6 for x in range(81)] +[ (x*9)+9 for x in range(81)] :
        print '|',
    if add_zeros == 1:
      if i in [ 27, 54, 81]:
        print '\n---------+----------+----------+'
      elif i in [ (x*9) for x in range(81)]:
        print '\n'
    else:
      if i in [ 27, 54, 81]:
        print '\n------+-------+-------+'
      elif i in [ (x*9) for x in range(81)]:
        print '\n'
import re
from collections import Counter

def words(text): return re.findall(r'\w+', text.lower())

WORDS = Counter(words(open('big.txt').read()))

def P(word, N=sum(WORDS.values())): 
    "Probability of `word`."
    return WORDS[word] / N

def correction(word): 
    "Most probable spelling correction for word."
    return max(candidates(word), key=P)

def candidates(word): 
    "Generate possible spelling corrections for word."
    return (known([word]) or known(edits1(word)) or known(edits2(word)) or [word])

def known(words): 
    "The subset of `words` that appear in the dictionary of WORDS."
    return set(w for w in words if w in WORDS)

def edits1(word):
    "All edits that are one edit away from `word`."
    letters    = 'abcdefghijklmnopqrstuvwxyz'
    splits     = [(word[:i], word[i:])    for i in range(len(word) + 1)]
    deletes    = [L + R[1:]               for L, R in splits if R]
    transposes = [L + R[1] + R[0] + R[2:] for L, R in splits if len(R)>1]
    replaces   = [L + c + R[1:]           for L, R in splits if R for c in letters]
    inserts    = [L + c + R               for L, R in splits for c in letters]
    return set(deletes + transposes + replaces + inserts)

def edits2(word): 
    "All edits that are two edits away from `word`."
    return (e2 for e1 in edits1(word) for e2 in edits1(e1))
class Solution(object):
    def letterCombinations(self, digits):
        """
        :type digits: str
        :rtype: List[str]
        """
        
# Python3 implementation of the approach 

# Function to sort the array such that 
# negative values do not get affected 
def sortArray(a, n): 

	# Store all non-negative values 
	ans=[] 
	for i in range(n): 
		if (a[i] >= 0): 
			ans.append(a[i]) 

	# Sort non-negative values 
	ans = sorted(ans) 

	j = 0
	for i in range(n): 

		# If current element is non-negative then 
		# update it such that all the 
		# non-negative values are sorted 
		if (a[i] >= 0): 
			a[i] = ans[j] 
			j += 1

	# Print the sorted array 
	for i in range(n): 
		print(a[i],end = " ") 


# Driver code 

arr = [2, -6, -3, 8, 4, 1] 

n = len(arr) 

sortArray(arr, n) 

a = []

if not a:
  print("List is empty")
if "blah" not in somestring: 
    continue
>>> from time import gmtime, strftime
>>> strftime("%Y-%m-%d %H:%M:%S", gmtime())
'2009-01-05 22:14:39'
import pathlib
pathlib.Path('/my/directory').mkdir(parents=True, exist_ok=True) 
import glob
print(glob.glob("/home/adam/*.txt"))
for idx, val in enumerate(ints):
    print(idx, val)
if 'key1' in dict:
  print "blah"
else:
  print "boo"
import time
time.sleep(5)   # Delays for 5 seconds. You can also use a float value.
x = tf.random_normal([300], mean = 5, stddev = 1)
y = tf.random_normal([300], mean = 5, stddev = 1)
avg = tf.reduce_mean(x - y)
cond = tf.less(avg, 0)
left_op = tf.reduce_mean(tf.square(x-y))
right_op = tf.reduce_mean(tf.abs(x-y))
out = tf.where(cond, left_op, right_op) #tf.select() has been fucking deprecated
>>> a = "545.2222"
>>> float(a)
545.22220000000004
>>> int(float(a))
545
bookmark
dashboard

Wed Jul 29 2020 19:19:59 GMT+0000 (UTC) https://stackoverflow.com/questions/18713321/element-wise-addition-of-2-lists

#python
bookmark
dashboard

Fri Jul 24 2020 12:56:27 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0134692888/ref=pd_lpo_14_img_0/145-2038954-9524128?_encoding=UTF8&pd_rd_i=0134692888&pd_rd_r=f9788605-6766-49b1-b966-4c7c269f2288&pd_rd_w=oV6YQ&pd_rd_wg=kSzf5&pf_rd_p=7b36d496-f366-4631-94d3-61b87b52511b&pf_rd_r=BBJNQXYRE82X8S5GDD2W&psc=1&refRID=BBJNQXYRE82X8S5GDD2W

#python
bookmark
dashboard

Tue Jul 21 2020 20:47:49 GMT+0000 (UTC) http://localhost:8888/notebooks/Desktop/for Jupyter/HW3/Exercise 3.ipynb

#python
bookmark
dashboard

Tue Jul 21 2020 19:59:28 GMT+0000 (UTC) http://localhost:8888/notebooks/Desktop/for Jupyter/Lesson3.ipynb

#python
bookmark
dashboard

Tue Jul 21 2020 19:28:03 GMT+0000 (UTC) http://localhost:8888/notebooks/Desktop/for Jupyter/HW check/Exercise 2b.ipynb

#python
bookmark
dashboard

Sat Jul 18 2020 14:09:51 GMT+0000 (UTC) http://apmonitor.com/pdc/index.php/Main/SolveDifferentialEquations

#python
bookmark
dashboard

Thu Jul 09 2020 13:14:43 GMT+0000 (UTC) https://stackoverflow.com/questions/59746080/count-max-consecutive-re-groups-in-a-string

#python
bookmark
dashboard

Tue Jun 30 2020 22:39:10 GMT+0000 (UTC)

#python #command
bookmark
dashboard

Mon Jun 29 2020 13:16:13 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python
bookmark
dashboard

Mon Jun 22 2020 13:35:43 GMT+0000 (UTC) https://stackoverflow.com/questions/1425493/convert-hex-to-binary

#python
bookmark
dashboard

Sun Jun 21 2020 20:14:12 GMT+0000 (UTC) https://stackoverflow.com/questions/62498842/custom-loss-in-keras-slow-at-compiling-and-fit

#python
bookmark
dashboard

Thu Jun 11 2020 12:57:24 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0134692888/ref=pd_lpo_14_img_0/145-2038954-9524128?_encoding=UTF8&pd_rd_i=0134692888&pd_rd_r=ef9c42e9-dfb9-4aa7-bd28-d4ef80f17296&pd_rd_w=aAQyc&pd_rd_wg=p8R5U&pf_rd_p=7b36d496-f366-4631-94d3-61b87b52511b&pf_rd_r=Y77J2N1H3EECZQ618R8B&psc=1&refRID=Y77J2N1H3EECZQ618R8B

#python
bookmark
dashboard

Mon Jun 08 2020 12:40:22 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0134692888/ref=pd_lpo_14_img_0/145-2038954-9524128?_encoding=UTF8&pd_rd_i=0134692888&pd_rd_r=ef9c42e9-dfb9-4aa7-bd28-d4ef80f17296&pd_rd_w=aAQyc&pd_rd_wg=p8R5U&pf_rd_p=7b36d496-f366-4631-94d3-61b87b52511b&pf_rd_r=Y77J2N1H3EECZQ618R8B&psc=1&refRID=Y77J2N1H3EECZQ618R8B

#python
bookmark
dashboard

Mon Jun 08 2020 12:33:50 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0134692888/ref=pd_lpo_14_img_0/145-2038954-9524128?_encoding=UTF8&pd_rd_i=0134692888&pd_rd_r=ef9c42e9-dfb9-4aa7-bd28-d4ef80f17296&pd_rd_w=aAQyc&pd_rd_wg=p8R5U&pf_rd_p=7b36d496-f366-4631-94d3-61b87b52511b&pf_rd_r=Y77J2N1H3EECZQ618R8B&psc=1&refRID=Y77J2N1H3EECZQ618R8B

#python
bookmark
dashboard

Sun Jun 07 2020 12:58:31 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0134692888/ref=pd_lpo_14_img_0/145-2038954-9524128?_encoding=UTF8&pd_rd_i=0134692888&pd_rd_r=2c1aff3f-60bb-490b-a2d0-dfc06d81970a&pd_rd_w=t9wy6&pd_rd_wg=Bmxlp&pf_rd_p=7b36d496-f366-4631-94d3-61b87b52511b&pf_rd_r=RTCDC9M99JAV7NJ30VVE&psc=1&refRID=RTCDC9M99JAV7NJ30VVE

#python
bookmark
dashboard

Sun Jun 07 2020 07:02:48 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0134692888/ref=pd_lpo_14_img_0/145-2038954-9524128?_encoding=UTF8&pd_rd_i=0134692888&pd_rd_r=2c1aff3f-60bb-490b-a2d0-dfc06d81970a&pd_rd_w=t9wy6&pd_rd_wg=Bmxlp&pf_rd_p=7b36d496-f366-4631-94d3-61b87b52511b&pf_rd_r=RTCDC9M99JAV7NJ30VVE&psc=1&refRID=RTCDC9M99JAV7NJ30VVE

#python
bookmark
dashboard

Sun Jun 07 2020 06:07:28 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0134692888/ref=pd_lpo_14_img_0/145-2038954-9524128?_encoding=UTF8&pd_rd_i=0134692888&pd_rd_r=2c1aff3f-60bb-490b-a2d0-dfc06d81970a&pd_rd_w=t9wy6&pd_rd_wg=Bmxlp&pf_rd_p=7b36d496-f366-4631-94d3-61b87b52511b&pf_rd_r=RTCDC9M99JAV7NJ30VVE&psc=1&refRID=RTCDC9M99JAV7NJ30VVE

#python
bookmark
dashboard

Sun Jun 07 2020 05:51:39 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0134692888/ref=pd_lpo_14_img_0/145-2038954-9524128?_encoding=UTF8&pd_rd_i=0134692888&pd_rd_r=2c1aff3f-60bb-490b-a2d0-dfc06d81970a&pd_rd_w=t9wy6&pd_rd_wg=Bmxlp&pf_rd_p=7b36d496-f366-4631-94d3-61b87b52511b&pf_rd_r=RTCDC9M99JAV7NJ30VVE&psc=1&refRID=RTCDC9M99JAV7NJ30VVE

#python
bookmark
dashboard

Sun Jun 07 2020 05:42:45 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0134692888/ref=pd_lpo_14_img_0/145-2038954-9524128?_encoding=UTF8&pd_rd_i=0134692888&pd_rd_r=2c1aff3f-60bb-490b-a2d0-dfc06d81970a&pd_rd_w=t9wy6&pd_rd_wg=Bmxlp&pf_rd_p=7b36d496-f366-4631-94d3-61b87b52511b&pf_rd_r=RTCDC9M99JAV7NJ30VVE&psc=1&refRID=RTCDC9M99JAV7NJ30VVE

#python
bookmark
dashboard

Sun Jun 07 2020 02:45:42 GMT+0000 (UTC)

#python
bookmark
dashboard

Fri Jun 05 2020 13:23:14 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python
bookmark
dashboard

Fri Jun 05 2020 12:49:02 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python
bookmark
dashboard

Fri Jun 05 2020 12:44:51 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python
bookmark
dashboard

Fri Jun 05 2020 12:41:10 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python
bookmark
dashboard

Fri May 29 2020 11:34:17 GMT+0000 (UTC) https://stackoverflow.com/questions/62084501/how-to-save-multiple-plots-as-seperate-png-files-with-names-in-python

#python
bookmark
dashboard

Fri May 29 2020 11:32:47 GMT+0000 (UTC) https://stackoverflow.com/questions/62084831/merge-a-single-list-of-dictionaries-with-the-same-key-value

#python
bookmark
dashboard

Fri May 29 2020 11:31:25 GMT+0000 (UTC) https://stackoverflow.com/questions/62084911/how-to-replace-values-of-each-cell-on-a-dataframe-without-looping-it

#python
bookmark
dashboard

Thu May 28 2020 21:57:47 GMT+0000 (UTC) https://stackoverflow.com/questions/11923317/creating-django-forms

#python
bookmark
dashboard

Wed May 27 2020 17:25:40 GMT+0000 (UTC) https://cmdlinetips.com/2018/01/how-to-read-entire-text-file-in-python/

#python
bookmark
dashboard

Wed May 27 2020 15:04:56 GMT+0000 (UTC) https://stackoverflow.com/questions/17351016/set-up-python-simplehttpserver-on-windows

#python
bookmark
dashboard

Tue May 26 2020 16:35:55 GMT+0000 (UTC)

#python
bookmark
dashboard

Mon May 25 2020 09:24:31 GMT+0000 (UTC) https://stackoverflow.com/questions/441147/how-to-subtract-a-day-from-a-date

#python
bookmark
dashboard

Sat May 16 2020 20:45:33 GMT+0000 (UTC) https://jakevdp.github.io/PythonDataScienceHandbook/01.07-timing-and-profiling.html

#python
bookmark
dashboard

Fri May 15 2020 09:11:04 GMT+0000 (UTC) https://stackoverflow.com/questions/53460391/passing-a-date-as-a-url-parameter-to-a-flask-route

#python
bookmark
dashboard

Fri May 15 2020 06:32:03 GMT+0000 (UTC) https://stackoverflow.com/questions/1060279/iterating-through-a-range-of-dates-in-python

#python
bookmark
dashboard

Tue May 12 2020 22:59:54 GMT+0000 (UTC) https://stackoverflow.com/questions/50486643/get-path-of-parent-keys-and-indices-in-dictionary-of-nested-dictionaries-and-l

#python
bookmark
dashboard

Mon May 11 2020 22:20:25 GMT+0000 (UTC) https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html

#python
bookmark
dashboard

Mon May 11 2020 13:44:16 GMT+0000 (UTC) https://stackoverflow.com/questions/15501673/how-to-temporarily-disable-a-foreign-key-constraint-in-mysql

#django #python
bookmark
dashboard

Thu May 07 2020 16:15:18 GMT+0000 (UTC) https://www.analyticsvidhya.com/blog/2020/04/how-to-read-common-file-formats-python/

#python
bookmark
dashboard

Tue Apr 21 2020 12:00:59 GMT+0000 (UTC)

#python #python #else #elif #clauses
bookmark
dashboard

Tue Apr 21 2020 11:45:29 GMT+0000 (UTC) https://towardsdatascience.com/30-helpful-python-snippets-that-you-can-learn-in-30-seconds-or-less-69bb49204172

#python #python #lists #dictionary
bookmark
dashboard

Tue Apr 21 2020 11:15:59 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python #python #condition #ifstatement #elifstatement #elsestatement
bookmark
dashboard

Tue Apr 21 2020 10:34:57 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python #python #ifstatement #comparisonoperators
bookmark
dashboard

Tue Apr 21 2020 06:41:13 GMT+0000 (UTC) https://docs.python.org/3/tutorial/controlflow.html

#python #python #ifstatement #elifstatement #elsestatement #comparisonoperators
bookmark
dashboard

Tue Apr 21 2020 06:34:03 GMT+0000 (UTC) https://learnandlearn.com/python-programming/python-reference/python-remove-list-all-items-clear-function-with-examples

#python #python #lists #clear #remove
bookmark
dashboard

Tue Apr 21 2020 06:29:54 GMT+0000 (UTC) https://www.programiz.com/python-programming/methods/list/append

#python #python #lists #add
bookmark
dashboard

Tue Apr 21 2020 06:18:35 GMT+0000 (UTC) .https://www.youtube.com/watch?v=rfscVS0vtbw&t=5s

#python #python #lists
bookmark
dashboard

Tue Apr 21 2020 06:12:11 GMT+0000 (UTC) https://beginnersbook.com/2018/01/python-while-loop/

#python #python #loop #whileloop #nestedwhile loop
bookmark
dashboard

Tue Apr 21 2020 05:48:50 GMT+0000 (UTC)

#python #python #loops #forloop #forelse
bookmark
dashboard

Tue Apr 21 2020 05:36:09 GMT+0000 (UTC) https://www.freecodecamp.org/news/python-example/

#python #python #loops #whileloop
bookmark
dashboard

Tue Apr 21 2020 05:22:45 GMT+0000 (UTC) https://stackoverflow.com/questions/5844672/delete-an-element-from-a-dictionary

#python #python #dictionary #del
bookmark
dashboard

Tue Apr 21 2020 05:10:22 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python #python #dictionary
bookmark
dashboard

Mon Apr 20 2020 13:58:55 GMT+0000 (UTC) https://towardsdatascience.com/30-helpful-python-snippets-that-you-can-learn-in-30-seconds-or-less-69bb49204172

#python #python #strings
bookmark
dashboard

Mon Apr 20 2020 13:45:46 GMT+0000 (UTC) https://towardsdatascience.com/30-helpful-python-snippets-that-you-can-learn-in-30-seconds-or-less-69bb49204172

#python #python #function #bytesize #return
bookmark
dashboard

Mon Apr 20 2020 13:38:08 GMT+0000 (UTC) https://www.30secondsofcode.org/python/s/compose/

#python #python #function #composition
bookmark
dashboard

Mon Apr 20 2020 13:32:07 GMT+0000 (UTC) https://www.youtube.com/watch?v=rfscVS0vtbw&t=5s

#python #python #function #return
bookmark
dashboard

Mon Apr 20 2020 13:17:59 GMT+0000 (UTC) https://www.youtube.com/watch?v=rfscVS0vtbw&t=5s

#python #function #python #def
bookmark
dashboard

Tue Mar 31 2020 11:54:39 GMT+0000 (UTC) ttps://www.programiz.com/python-programming/while-loop

#python #pyhton #loops #whileloop
bookmark
dashboard

Tue Mar 31 2020 11:40:31 GMT+0000 (UTC) https://towardsdatascience.com/30-helpful-python-snippets-that-you-can-learn-in-30-seconds-or-less-69bb49204172

#python #python #function #return #allunique
bookmark
dashboard

Tue Mar 31 2020 11:35:03 GMT+0000 (UTC) https://towardsdatascience.com/30-helpful-python-snippets-that-you-can-learn-in-30-seconds-or-less-69bb49204172

#python #python #strings #vowels #function
bookmark
dashboard

Tue Mar 31 2020 11:27:37 GMT+0000 (UTC)

#python #python #printfunction #strings
bookmark
dashboard

Tue Mar 31 2020 06:23:25 GMT+0000 (UTC) https://towardsdatascience.com/30-helpful-python-snippets-that-you-can-learn-in-30-seconds-or-less-69bb49204172

#python #python #len #bytesize #strings
bookmark
dashboard

Tue Mar 31 2020 05:43:21 GMT+0000 (UTC) https://www.youtube.com/watch?v=rfscVS0vtbw&t=5s

#python #function #returnfunction
bookmark
dashboard

Tue Mar 31 2020 05:32:45 GMT+0000 (UTC)

#python #python #dictionary #mergedictionary #dict
bookmark
dashboard

Tue Mar 31 2020 05:29:39 GMT+0000 (UTC)

#python #python #loops #forloop #nestedfor loop
bookmark
dashboard

Tue Mar 31 2020 05:21:34 GMT+0000 (UTC) https://www.programiz.com/python-programming/methods/list/remove

#python #python #remove #lists
bookmark
dashboard

Tue Mar 31 2020 05:18:11 GMT+0000 (UTC)

#python #python #extendfunction
bookmark
dashboard

Mon Mar 30 2020 12:23:56 GMT+0000 (UTC) https://www.tutorialspoint.com/python/nested_if_statements_in_python.htm

#python #python #ifstatement #nestedif statement
bookmark
dashboard

Mon Mar 30 2020 12:18:27 GMT+0000 (UTC) https://www.30secondsofcode.org/python/s/unfold/

#python #python #iterator #functions
bookmark
dashboard

Mon Mar 30 2020 12:10:17 GMT+0000 (UTC) https://www.youtube.com/watch?v=rfscVS0vtbw&t=5s

#python #python #dictionary #keys
bookmark
dashboard

Mon Mar 30 2020 12:04:52 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python #python #ifstatement #elifstatement #elsestatement #comparisonoperators
bookmark
dashboard

Mon Mar 30 2020 10:16:54 GMT+0000 (UTC) https://www.amazon.com/Learn-Python-Hard-Way-Introduction/dp/0321884914

#python ##python #strings #comments
bookmark
dashboard

Mon Mar 30 2020 07:50:40 GMT+0000 (UTC) 1. https://www.youtube.com/watch?v=rfscVS0vtbw&t=5s.

#python ##python ##pythonlists
bookmark
dashboard

Mon Mar 30 2020 07:07:27 GMT+0000 (UTC) https://stackoverflow.com/questions/89228/calling-an-external-command-from-python

#python #python #shell #command #terminal
bookmark
dashboard

Mon Mar 23 2020 07:13:49 GMT+0000 (UTC) https://www.30secondsofcode.org/python/s/max-by/

#python #python #math #list
bookmark
dashboard

Fri Feb 21 2020 22:36:19 GMT+0000 (UTC)

#python
bookmark
dashboard

Fri Feb 21 2020 18:02:15 GMT+0000 (UTC)

#python #commandline
bookmark
dashboard

Sun Feb 16 2020 18:21:25 GMT+0000 (UTC)

#python
bookmark
dashboard

Thu Feb 06 2020 19:00:00 GMT+0000 (UTC)

#python #numbers
bookmark
dashboard

Wed Jan 22 2020 18:52:28 GMT+0000 (UTC) https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime

#python #dates #functions #python3.8
bookmark
dashboard

Sat Jan 11 2020 20:54:48 GMT+0000 (UTC) https://www.30secondsofcode.org/python/s/when/

#python #function
bookmark
dashboard

Fri Jan 10 2020 19:00:00 GMT+0000 (UTC) https://www.30secondsofcode.org/python/s/unfold/

#python #lists #function
bookmark
dashboard

Thu Jan 09 2020 19:00:00 GMT+0000 (UTC) https://www.30secondsofcode.org/python/s/compose/

#python #function
bookmark
dashboard

Thu Jan 02 2020 19:00:00 GMT+0000 (UTC) https://en.wikipedia.org/wiki/PageRank

#javascript #python #search #historicalcode #google #algorithms
bookmark
dashboard

Thu Jan 02 2020 19:00:00 GMT+0000 (UTC) https://docs.python.org/3.4/library/html.parser.html

#html #python #xhtml
bookmark
dashboard

Wed Jan 01 2020 19:00:00 GMT+0000 (UTC) https://www.python-course.eu/towers_of_hanoi.php

#python #puzzles #interesting
bookmark
dashboard

Wed Jan 01 2020 19:00:00 GMT+0000 (UTC) http://code.activestate.com/recipes/578140-super-simple-sudoku-solver-in-python-source-code/

#python #puzzles
bookmark
dashboard

Sun Dec 29 2019 19:13:40 GMT+0000 (UTC) http://norvig.com/spell-correct.html

#python #interesting #logic
bookmark
dashboard

Thu Dec 26 2019 18:45:53 GMT+0000 (UTC) https://leetcode.com/problems/letter-combinations-of-a-phone-number/

#python #interviewquestions #interesting
bookmark
dashboard

Thu Dec 26 2019 15:35:22 GMT+0000 (UTC) https://www.geeksforgeeks.org/sort-an-array-without-changing-position-of-negative-numbers/

#python #interesting #arrays #sorting #interviewquestions
bookmark
dashboard

https://stackoverflow.com/questions/1602934/check-if-a-given-key-already-exists-in-a-dictionary

#python

.

bookmark
dashboard

https://stackoverflow.com/questions/53513/how-do-i-check-if-a-list-is-empty

#python

.

bookmark
dashboard

https://stackoverflow.com/questions/3437059/does-python-have-a-string-contains-substring-method

#python

.

bookmark
dashboard

https://stackoverflow.com/questions/415511/how-to-get-the-current-time-in-python

#python

.

bookmark
dashboard

https://stackoverflow.com/questions/273192/how-can-i-safely-create-a-nested-directory-in-python

#python

.

bookmark
dashboard

https://stackoverflow.com/questions/3207219/how-do-i-list-all-files-of-a-directory

#python

.

bookmark
dashboard

https://stackoverflow.com/questions/522563/accessing-the-index-in-for-loops

#python

.

bookmark
dashboard

https://stackoverflow.com/questions/1602934/check-if-a-given-key-already-exists-in-a-dictionary

#python

.

bookmark
dashboard

https://stackoverflow.com/questions/510348/how-can-i-make-a-time-delay-in-python

#python

.

bookmark
dashboard
bookmark
dashboard

https://stackoverflow.com/questions/3277503/how-to-read-a-file-line-by-line-into-a-list

#python

.

bookmark
dashboard

https://stackoverflow.com/questions/379906/how-do-i-parse-a-string-to-a-float-or-int-in-python

#python

.

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension