This file contains 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
""" | |
Rotate a matrix clockwise by 90 degrees | |
""" | |
def iter_matrix_outline(n): | |
for j in range(0, n): | |
yield (0, j) | |
for i in range(1, n): | |
yield (i, n-1) | |
for j in range(n-2, -1, -1): |
This file contains 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
from flask import Flask, request | |
import sqlite3, time | |
app = Flask("Twitter clone") | |
def add_tweet(tweet): | |
moment = timeString = time.strftime("%Y-%m-%d %H:%M %p", time.localtime()) | |
c.execute("INSERT INTO tweets VALUES('Guest', ?, ?)", (tweet, moment)) | |
conn.commit() |
This file contains 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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
"errors" | |
"log" | |
) |