From ae5b96d174949e5b7d18b7627739fb7ade6976b1 Mon Sep 17 00:00:00 2001 From: Geethegreat <86944224+Geethegreat@users.noreply.github.com> Date: Tue, 26 Oct 2021 16:36:37 +0530 Subject: [PATCH 1/2] Added a simple function to connect to a database --- Python/database_connector.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Python/database_connector.py diff --git a/Python/database_connector.py b/Python/database_connector.py new file mode 100644 index 0000000..f47bab4 --- /dev/null +++ b/Python/database_connector.py @@ -0,0 +1,13 @@ +import MySQLdb + +db = MySQLdb.connect(host= input("> Input the your host adress here: "), + user=input("> Input your username here: "), + passwd=input("> Input your password here"), + db=input("> Input the name of your Database here: ")) +print("connection successful") +cur = db.cursor() + +cur.execute(input("> Input the file you want to open in your Database")) + +for row in cur.fetchall(): + print(row[0]) \ No newline at end of file From 1b3801bd72aa4b54573cb158a5d874ee15ceac7e Mon Sep 17 00:00:00 2001 From: Geethegreat <86944224+Geethegreat@users.noreply.github.com> Date: Tue, 26 Oct 2021 17:48:43 +0530 Subject: [PATCH 2/2] updated calc.py --- Python/calc.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Python/calc.py b/Python/calc.py index b50d702..ca310f3 100644 --- a/Python/calc.py +++ b/Python/calc.py @@ -1,3 +1,4 @@ +import math def addition (): print("Addition") n = float(input("Enter the number: ")) @@ -34,6 +35,9 @@ def multiplication (): print(" Enter 's' for substraction") print(" Enter 'm' for multiplication") print(" Enter 'q' for quit") + print(" Enter 'si' for sin function") + print(" Enter 't' for tan function") + print(" Enter 'c' for cos function") c = input(" ") if c != 'q': if c == 'a': @@ -48,6 +52,16 @@ def multiplication (): elif c == 'v': list = average() print("Ans = ", list[0], " total inputs ",list[1]) + elif c == 'si': + x = int(input("> Enter your number here: ")) + print(math.sin(x)) + elif c == 'c': + x = int(input("> Enter your number here: ")) + print(math.cos(x)) + elif c == 't': + x = int(input("> Enter your number here: ")) + print(math.tan(x)) + else: print ("Sorry, invilid character") else: