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 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(): |
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
#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)) |
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
pip install python3-venv |
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
python3 -m venv venv |
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
venv\Scripts\activate |
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
Pip install stream-python flask-bootstrap flask-sqlalchemy flask-moment |
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
set FLASK_APP=application.py | |
flask run |
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_bootstrap import Bootstrap | |
from flask_sqlalchemy import SQLAlchemy | |
from flask_moment import Moment | |
bootstrap = Bootstrap() | |
db = SQLAlchemy() | |
moment = Moment() |
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 | |
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) |
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
class ValidationError(ValueError): | |
pass |
OlderNewer