Advertisement
TorroesPrime

Untitled

Sep 3rd, 2023
1,013
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. from flask import Flask
  2. from random import randint
  3. app = Flask(__name__)
  4.  
  5. CHOSEN = randint(0, 9)
  6. def draw_banner():
  7.     return "<h1>Welcome to the Band Name Generator.</h1>"
  8.  
  9. @app.route('/')
  10. def hello_world():
  11.     content = ""
  12.     content += draw_banner()
  13.     content += "\n"
  14.     return content + 'Hello, World!'
  15. @app.route("/<int:number>")
  16. def check_number(number):
  17.     if number > CHOSEN:
  18.         return "Too high"
  19.     elif number < CHOSEN:
  20.         return "Too low"
  21.     else:
  22.         return "You found me!"
  23.  
  24. if __name__ == "__main__":
  25.     app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement