Skip to content

Instantly share code, notes, and snippets.

View Porter97's full-sized avatar

Spencer Porter Porter97

  • Ottawa
View GitHub Profile
from random import randint
def script():
restart = raw_input("Would you like to play again?")
if restart == "yes" or restart == "y":
return Battleship()
if restart == "n" or restart == "no":
print "Goodbye."
def Battleship():
#sum
def x_sum(x_input):
x = 0
for each in x_input:
x += each
return x
#average
def x_average(x_input):
x = x_sum(x_input)/float(len(x_input))
@Porter97
Porter97 / python3-venv.sh
Created January 22, 2020 15:17
Python3-venv-windows
pip install python3-venv
python3 -m venv venv
venv\Scripts\activate
Pip install stream-python flask-bootstrap flask-sqlalchemy flask-moment
set FLASK_APP=application.py
flask run
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from flask_moment import Moment
bootstrap = Bootstrap()
db = SQLAlchemy()
moment = Moment()
from flask import Flask
from .extensions import bootstrap, db, moment
from config import config
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
config[config_name].init_app(app)
bootstrap.init_app(app)
class ValidationError(ValueError):
pass