Posts

Showing posts from January, 2022

Python sudoku shortest code ever

def r(a):i=a.find('0');~i or exit(a);[m in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for j in range(81)]or r(a[:i]+m+a[i+1:])for m in'%d'%5**18] from sys import*;r(argv[1])   Src: http://www.scottkirkwood.com/2006/07/shortest-sudoku-solver-in-python.html Original Source:   Mark Byer's site has some more  Sudoku solvers     (can be found on web archive as web site is down) Expalanation https://jakevdp.github.io/blog/2013/04/15/code-golf-in-python-sudoku/ NOTE "A=0 #False B=20#True print(A or B) #B A=1 #True B=0#False print(A or B) #A you might expect the result to be either True or False. Instead, Python does something a bit clever. If the result is False, it returns A (which, naturally, evaluates to False).  If the result is True, it returns A if A evaluates to True, and B otherwise.  We can use this fact to remove the if statement completely from the set comprehension

Solving maze puzzle in python

 This is a 5*5 puzzle solution def print_maze(maze):     for i in maze:         for j in i:             print(j,end="")         print() def find_start(maze):     for i in range(5):         for j in range(5):             if maze[i][j]=="S":                 return i,j     return False def is_valid_position(maze,r,c):     if r<0 or c<0:         return False     if r>4 or c>4:         return False     if maze[r][c] in " E":         return True     return False def solve(maze):     stack=[]     if find_start(maze):         stack.append( (find_start(maze)))     print("Stack is ",stack)     while len(stack)>0:      ...

Email Marketing

  How to do email marketing? Email marketing is an act of sending a commercial message typically to a group of  people using email Email marketing is used by thousands of businesses of all sizes across the globe.   Benefits of Email Marketing 1. Low costs One of the most obvious advantages of email marketing is its lower cost compared to mainstream marketing channels. There are no print or postage costs and no fees paid in exchange for exposure on a certain billboard, magazine or television channel. But Email marketers should consider investing in specialist software to automate, track and evaluate their emails.   2. Reach an already engaged audience Email marketing is one of the only channels that consumers ask to receive. The majority of businesses using the platform only send messages to those who have signed up to receive them.   3.Drive revenue Marketing Week reports that email generates around £29bn retail sales annually. Us...