From 7005d384cc12be96e854ad62128ccb3dcf9b5502 Mon Sep 17 00:00:00 2001 From: Jainish1604 <65968029+Jainish1604@users.noreply.github.com> Date: Thu, 1 Oct 2020 00:15:11 +0530 Subject: [PATCH 1/3] Rename to Guessing-game.py made a guessing game using python --- Python program/Guessing-game.py | 18 ++++++++++++++++++ Python program/hw.py | 1 - 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 Python program/Guessing-game.py delete mode 100644 Python program/hw.py 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!"); From 6ea80664a49d63f9b24bd0c69c878d08165becb4 Mon Sep 17 00:00:00 2001 From: Jainish <65968029+Jainish1604@users.noreply.github.com> Date: Wed, 17 Mar 2021 22:17:57 +0530 Subject: [PATCH 2/3] Add files via upload Flask app to Take Data from ligin form --- Python_flask_hello_world/Main.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Python_flask_hello_world/Main.py diff --git a/Python_flask_hello_world/Main.py b/Python_flask_hello_world/Main.py new file mode 100644 index 000000000..1036ad613 --- /dev/null +++ b/Python_flask_hello_world/Main.py @@ -0,0 +1,28 @@ +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) \ No newline at end of file From b17b4a6170bc2f8668291076d40d6af40f31a278 Mon Sep 17 00:00:00 2001 From: Jainish <65968029+Jainish1604@users.noreply.github.com> Date: Wed, 17 Mar 2021 22:20:20 +0530 Subject: [PATCH 3/3] Login data to database Login form take toh data toh database --- Python_flask_hello_world/Main.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Python_flask_hello_world/Main.py b/Python_flask_hello_world/Main.py index 1036ad613..edd8c2827 100644 --- a/Python_flask_hello_world/Main.py +++ b/Python_flask_hello_world/Main.py @@ -1,13 +1,10 @@ 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) @@ -25,4 +22,4 @@ def home(): if __name__ == '__main__': - app.run(debug = True) \ No newline at end of file + app.run(debug = True)