Skip to content

Instantly share code, notes, and snippets.

View vihar's full-sized avatar
🚀

Vihar Kurama vihar

🚀
View GitHub Profile
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,
import gym
env = gym.make("Taxi-v2").env
env.render()
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)
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)
<html>
<body>
{% if name %}
<h2>Hello {{ name }}.</h2>
{% else %}
<h2>Hello.</h2>
{% endif %}
</body>
</html>
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)
from flask import Flask
app = Flask(__name__)
@app.route('/greet')
def greet():
user = {'username': 'John', 'age': "20"}
return '''
<html>
<head>
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__)
<!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>
<!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 }}