diff --git a/Python program/Guessing-game.py b/Python program/Guessing-game.py new file mode 100644 index 000000000..d8df96536 --- /dev/null +++ b/Python program/Guessing-game.py @@ -0,0 +1,18 @@ +import random +hiddenNumber = random.randrange(1, 100) +chances = 4 +print("Guess the number") +while chances != 0: + guess = int(input()) + chances = chances-1 + if guess == hiddenNumber: + print("You Won!") + break + elif guess > hiddenNumber: + print("Smaller Number Please") + print(chances, "chances left") + continue + else: + print("Higher Number Please") + print(chances, "chances left") + continue diff --git a/Python program/hw.py b/Python program/hw.py deleted file mode 100644 index fbd9f3b8b..000000000 --- a/Python program/hw.py +++ /dev/null @@ -1 +0,0 @@ -print("hello world!"); diff --git a/Python_flask_hello_world/Main.py b/Python_flask_hello_world/Main.py new file mode 100644 index 000000000..edd8c2827 --- /dev/null +++ b/Python_flask_hello_world/Main.py @@ -0,0 +1,25 @@ +from flask import Flask, render_template, request +from flask_sqlalchemy import SQLAlchemy + +app = Flask(__name__) +app.config['SQLALCHEMY_DATABASE_URI']='mysql://root:''@localhost/login' +db = SQLAlchemy(app) + +class Login(db.Model): + sno = db.Column(db.Integer, primary_key=True) + email = db.Column(db.String(50), nullable=False) + password = db.Column(db.String(50), nullable=False) + +@app.route('/', methods=["GET","POST"]) +def home(): + if (request.method == 'POST'): + email = request.form.get('email') + password = request.form.get('passw') + admin = Login(email=email, password=password) + db.session.add(admin) + db.session.commit() + return render_template('Login.html') + + +if __name__ == '__main__': + app.run(debug = True)