From 3650c370d16b6365613071cd15e7c98b937ffe50 Mon Sep 17 00:00:00 2001 From: priyapriyadarshani429 <108543294+priyapriyadarshani429@users.noreply.github.com> Date: Fri, 1 Jul 2022 22:47:50 +0530 Subject: [PATCH 1/4] Delete Problem Statement 1 directory --- Problem Statement 1/README.md | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 Problem Statement 1/README.md diff --git a/Problem Statement 1/README.md b/Problem Statement 1/README.md deleted file mode 100644 index 6aaeab6..0000000 --- a/Problem Statement 1/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Problem Statement-1. - - -*** -### Make a desktop assistant using Python as its backend - - - -*** - From 013a86c2a165b50890340565e79722f3a18aeb8d Mon Sep 17 00:00:00 2001 From: priyapriyadarshani429 <108543294+priyapriyadarshani429@users.noreply.github.com> Date: Fri, 1 Jul 2022 22:48:00 +0530 Subject: [PATCH 2/4] Delete Problem Statement 2 directory --- Problem Statement 2/README.md | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 Problem Statement 2/README.md diff --git a/Problem Statement 2/README.md b/Problem Statement 2/README.md deleted file mode 100644 index baf2489..0000000 --- a/Problem Statement 2/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Problem Statement-2. - - -*** -### Make a Simple Image Editing app - - - -*** - From 6c417e26d72797f4fcfca6717cedac034f705871 Mon Sep 17 00:00:00 2001 From: priyapriyadarshani429 <108543294+priyapriyadarshani429@users.noreply.github.com> Date: Fri, 1 Jul 2022 22:48:11 +0530 Subject: [PATCH 3/4] Delete README.md --- README.md | 66 ------------------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index dd00367..0000000 --- a/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# GAME OF CODES - - - -# How to Register in GAME OF CODES - -#### Step1: Register yourself in our website - -[Hack2skill Website](https://hack2skill.com/hack/goc3) - -#### Step2: Join our discord server - -[Hack2skill Discord Server](https://discord.gg/2acmdTsKeR) - -#### Step3: Follow our github organization - -[Hack2skill GitHub Organization](https://github.com/hack2skill) - -#### Step4: Read the guidelines -*** - -## Guidelines for the participants: - -1. Participant should register for the competition in our website. -2. Should join our discord server. -3. Participants can participate individually only. -4. Please refrain from discussing strategy during the contest. -5. Do not share your code during the contest. -6. Plagiarism of any means will lead to disqualification. -7. All submissions will run through a plagiarism detector before deciding the winners.Any case of code plagiarism will disqualify both users from the contest & their scores would be set to null for the particular contest. -8. The decisions of the panel will be final and binding in all forms. - -#### Step5: Read the Score Criteria : - - -### Important Note: - -Primary Shortlisting would be based on the video, hence try to make the video of good quality. - -## Score Criteria: - -Scores are given out of 100 based on : - -Creativity of the Project (10 points)
-Unique Selling Point (10 points)
-Solving the Problem Statement (10 points)
-Presentation Skills - eg. Video (10 points)
-Applying GUI - eg. Browser using Django/Flask or Tkinter (10 points )
- - -*** - - -#### Step6: Be active in our discord server - -# Project Submission: -#### Step7: Compete with others by making a PR in our repository - -Participants have to make a video (screen recording) of the workings of their project. - -They need to upload the project code to the Github.
-Step 7.1: Fork the main repository
-Step 7.2: Delete the problem statement folders you are not working on
-Step 7.3: Upload the video of its working in the main folder and files in the problem statement folder
-Step 7.4: Send pull request to the repository
-*** From b89157677eb97c54c87ce40b21e02a77c76b86b2 Mon Sep 17 00:00:00 2001 From: priyapriyadarshani429 <108543294+priyapriyadarshani429@users.noreply.github.com> Date: Fri, 1 Jul 2022 22:48:58 +0530 Subject: [PATCH 4/4] Add files via upload --- Problem Statement 3/README.md | 11 +--- Problem Statement 3/calculator.py | 95 +++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 Problem Statement 3/calculator.py diff --git a/Problem Statement 3/README.md b/Problem Statement 3/README.md index b4683b3..9b74730 100644 --- a/Problem Statement 3/README.md +++ b/Problem Statement 3/README.md @@ -1,10 +1 @@ -# Problem Statement-3. - - -*** -### Make a calculator with GUI - - - -*** - +# calcalutor in python for GOC Hack2skill diff --git a/Problem Statement 3/calculator.py b/Problem Statement 3/calculator.py new file mode 100644 index 0000000..8511a17 --- /dev/null +++ b/Problem Statement 3/calculator.py @@ -0,0 +1,95 @@ +import sys +import math +## Imported math library to run sin(), cos(), tan() and other such functions in the calculator + + + + +def calc(term): + """ + input: term of type str + output: returns the result of the computed term. + purpose: This function is the actual calculator and the heart of the application + """ + + # This part is for reading and converting arithmetic terms. + term = term.replace(' ', '') + term = term.replace('^', '**') + term = term.replace('=', '') + term = term.replace('?', '') + term = term.replace('%', '/100.00') + term = term.replace('rad', 'radians') + term = term.replace('mod', '%') + term = term.replace('aval', 'abs') + + functions = ['sin', 'cos', 'tan', 'pow', 'cosh', 'sinh', 'tanh', 'sqrt', 'pi', 'radians', 'e'] + + # This part is for reading and converting function expressions. + term = term.lower() + + for func in functions: + if func in term: + withmath = 'math.' + func + term = term.replace(func, withmath) + + try: + + # here goes the actual evaluating. + term = eval(term) + + # here goes to the error cases. + except ZeroDivisionError: + + print("Can't divide by 0. Please try again.") + + except NameError: + + print('Invalid input. Please try again') + + except AttributeError: + + print('Please check usage method and try again.') + except TypeError: + print("please enter inputs of correct datatype ") + + except Exception: + print("Wrong operator") + + return term + + +def result(term): + """ + input: term of type str + output: none + purpose: passes the argument to the function calc(...) and + prints the result onto console. + """ + print("\n" + str(calc(term))) + + +def main(): + """ + main-program + purpose: handles user input and prints + information to the console. + """ + + + if sys.version_info.major >= 3: + while True: + k = input("\nWhat is ") + if k == 'quit': + break + result(k) + + else: + while True: + k = raw_input("\nWhat is ") + if k == 'quit': + break + result(k) + + +if __name__ == '__main__': + main() \ No newline at end of file