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
import gym | |
from time import sleep | |
# Creating thr env | |
env = gym.make("Taxi-v2").env | |
env.s = 328 | |
# Setting the number of iterations, penalties and reward to zero, |
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
import gym | |
env = gym.make("Taxi-v2").env | |
env.render() |
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, render_template | |
app = Flask(__name__) | |
@app.route('/hello') | |
def hello(): | |
return render_template('index.html', name="Alex") | |
if __name__ == '__main__': | |
app.run(debug = True) |
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, render_template | |
app = Flask(__name__) | |
@app.route('/hello') | |
def hello(): | |
return render_template('index.html', name="Alex") | |
if __name__ == '__main__': | |
app.run(debug = True) |
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
<html> | |
<body> | |
{% if name %} | |
<h2>Hello {{ name }}.</h2> | |
{% else %} | |
<h2>Hello.</h2> | |
{% endif %} | |
</body> | |
</html> |
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 | |
app = Flask(__name__) | |
@app.route('/hello/<name>') | |
def hello(name=”Stark”): | |
return render_template('index.html', name=name) | |
if __name__ == '__main__': | |
app.run(debug = True) |
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 | |
app = Flask(__name__) | |
@app.route('/greet') | |
def greet(): | |
user = {'username': 'John', 'age': "20"} | |
return ''' | |
<html> | |
<head> |
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, render_template, url_for, redirect | |
from flask_sqlalchemy import SQLAlchemy | |
from flask_script import Manager | |
from flask_migrate import Migrate, MigrateCommand | |
from flask_wtf import FlaskForm | |
from wtforms import StringField | |
from wtforms.validators import DataRequired | |
app = Flask(__name__) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Posts</title> | |
</head> | |
<body> | |
<h1>Posts</h1> | |
{% for i in posts %} | |
<h1>Post Title : {{ i.title }}</h1> | |
<p>Description : {{ i.post_text }}</p> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Add Post</title> | |
</head> | |
<body> | |
<h1>Add Post</h1> | |
<form action="/posts" method="post"> | |
<label>Post Title</label> | |
{{ postform.title }} |