Skip to content

Instantly share code, notes, and snippets.

@kaustubhgupta
Created April 17, 2022 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaustubhgupta/c1968b1e5ecc1c55926cd81678b6d789 to your computer and use it in GitHub Desktop.
Save kaustubhgupta/c1968b1e5ecc1c55926cd81678b6d789 to your computer and use it in GitHub Desktop.
from flask import Flask, render_template
app = Flask(__name__)
class Car:
def __init__(self, name: str, engine: str) -> None:
self.name = name
self.engine = engine
def getMaxSpeed(self) -> int:
if self.name.lower() == 'audi' and self.engine.lower() == 'v2':
return 300
elif self.name.lower() == 'tesla' and self.engine.lower() == 'v3':
return 250
else:
return 100
@app.route('/', methods=['GET', 'POST'])
def index():
return render_template('new.html',
string_ = 'Kaustubh',
integer = 22.45,
skills = ['Python', 'Go', 'C++'],
dictionary = {
"1st_year": 34,
"2nd_year": 21,
"3rd_year": 64,
"4th_year": 43
},
set_1 = {1, 2, 3, 4},
set_2 = {3, 4, 5, 6},
class_ = Car('audi', 'v2')
)
if __name__ == "__main__":
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment