Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Python script to get your current location #229

Closed
wants to merge 180 commits into from
Closed
Show file tree
Hide file tree
Changes from 179 commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
ad82558
Added python email client
PatelKeviin Aug 16, 2020
a2f6a4c
Added Script for guessing game
ultraUnicorn74 Aug 16, 2020
5a3156b
Added Script for guessing game
ultraUnicorn74 Aug 16, 2020
d676736
Added Script for guessing game
ultraUnicorn74 Aug 16, 2020
5c2ca00
Added scripts for guessing game
ultraUnicorn74 Aug 16, 2020
e064a51
Added script for guessing game
ultraUnicorn74 Aug 16, 2020
c9f0255
Added Script for guessing game
ultraUnicorn74 Aug 16, 2020
fef57bf
Added Scripts for guessing game
ultraUnicorn74 Aug 16, 2020
2ce4fdb
Added word_detector to System Automation Scripts
AdityaJ7 Aug 16, 2020
3662306
Add files via upload
abhip99 Aug 16, 2020
b23263b
Counter to count the number of items in a list
Nagasuruthika Aug 16, 2020
4e9e8d1
Update int_to_en.py
abhip99 Aug 16, 2020
2ca3e39
Update int_to_en.py
abhip99 Aug 16, 2020
5416524
Updated Script
Nagasuruthika Aug 16, 2020
c131490
Update int_to_en.py
abhip99 Aug 16, 2020
feec0b0
Script to print a christmas tree pattern
Nagasuruthika Aug 16, 2020
c96f41f
Created a basic user friendly Calculator
muskangoyal06 Aug 16, 2020
5293da8
Updated Script
Nagasuruthika Aug 17, 2020
16ec4ec
Delete listcounter.py
Nagasuruthika Aug 17, 2020
95aa110
Create staicase.py
Adityanagraj Aug 17, 2020
1718272
Merge pull request #1 from ankitdobhal/master
GudlaArunKumar Aug 17, 2020
cccdb85
updated the staircase.py
Adityanagraj Aug 17, 2020
c73bb93
Added Jpg to Png Image convertor script
GudlaArunKumar Aug 17, 2020
8505437
added main function and updated the variables name
Adityanagraj Aug 17, 2020
c23c299
Update JpgToPngConvertor.py
GudlaArunKumar Aug 17, 2020
2dc148e
Adding Python Script for Rock Paper Scissor Game
gulshanbaraik01 Aug 17, 2020
0e6e53d
Rename staicase.py to staicase_pattern.py
Adityanagraj Aug 17, 2020
e815d0e
added function documentation
Adityanagraj Aug 17, 2020
8b232f2
Added scripts for the Amazon price tracker
Aug 17, 2020
07a3abd
Updated price_tracker.py
Aug 17, 2020
2428bf1
Renamed File name
Nagasuruthika Aug 17, 2020
26b52e8
Made the program more dynamic
Nagasuruthika Aug 17, 2020
e262d3f
Update Rock_paper_scissor.py
gulshanbaraik01 Aug 17, 2020
2ffce91
Update Rock_paper_scissor.py
gulshanbaraik01 Aug 17, 2020
147be7e
Hello,
Vaibhavabhaysharma Aug 17, 2020
769bd50
Update Calculator.py
muskangoyal06 Aug 17, 2020
8c96126
Advance calculator script
amandp13 Aug 17, 2020
d2a8fb4
Update Simple_calculator.py
muskangoyal06 Aug 17, 2020
cb87b65
Delete Calculator.py
muskangoyal06 Aug 17, 2020
98ce2cb
Documented the script
Nagasuruthika Aug 17, 2020
4dee149
updated Readme file
GudlaArunKumar Aug 17, 2020
985ebe0
Images added to a separate folder
Aug 17, 2020
86a586b
Add files via upload
zenit-abh Aug 17, 2020
d664f55
Add files via upload
prasadvpatil Aug 17, 2020
1c68bcb
Add files via upload
zenit-abh Aug 17, 2020
99ea7d7
Merge pull request #2 from ankitdobhal/master
kaustubhgupta Aug 17, 2020
5c22945
Update Simple_calculator.py
muskangoyal06 Aug 17, 2020
56aead0
Update README.md file
PatelKeviin Aug 18, 2020
66892b6
Added Readme and created a separate folder
AdityaJ7 Aug 18, 2020
26ba78c
Update README.md
AdityaJ7 Aug 18, 2020
4497ebf
Update Rock_paper_scissor.py
gulshanbaraik01 Aug 18, 2020
59cf0cd
Update Compress_the_string.py
Vaibhavabhaysharma Aug 18, 2020
f3b5549
updated main function
Nagasuruthika Aug 18, 2020
afd596c
Updated Title and Sample Output
Nagasuruthika Aug 18, 2020
ea5500f
Merge pull request #1 from ankitdobhal/master
arjuaman Aug 18, 2020
d56321a
first commit
kapilkumar2001 Aug 19, 2020
917b198
Update count_positive_and_negative.py
kapilkumar2001 Aug 19, 2020
ad450aa
Tic Tac Toe code ib basic python
snehagupta-4 Aug 19, 2020
9a1e7e9
Made suggested Changes
Nagasuruthika Aug 19, 2020
4e970e8
Updated the documentation
Nagasuruthika Aug 19, 2020
ab492a9
Rename tic-tac-toe.py to tic-tac-toe-1.py
powerexploit Aug 19, 2020
b3eb2a4
Merge pull request #171 from snehagupta-4/tictactoe
powerexploit Aug 19, 2020
4777a7e
Added watermark pdf script to Basic script folder
GudlaArunKumar Aug 19, 2020
b1293df
Update count_positive_and_negative.py
kapilkumar2001 Aug 19, 2020
3eca150
Update count_positive_and_negative.py
kapilkumar2001 Aug 19, 2020
6afb0eb
Merge pull request #138 from GudlaArunKumar/JpgToPngConvertor
powerexploit Aug 19, 2020
2ba06f4
created folder
Aug 19, 2020
584034d
Create README.md
ryuk156 Aug 19, 2020
8fa022f
Add files via upload
ryuk156 Aug 19, 2020
c10d917
added all files
Aug 19, 2020
bff24cd
Create README.md
ryuk156 Aug 19, 2020
bc6b430
added all files
Aug 19, 2020
a0e6d22
added all files
Aug 19, 2020
8a9cfca
Awesome-Python-Scripts Updated
powerexploit Jul 20, 2020
36d19dd
Twitter Automation.py Added
sharur7 Aug 18, 2020
edb5538
snake to camel case
komaldevnani Aug 19, 2020
2b59ca4
description added
komaldevnani Aug 19, 2020
107299c
added files
Aug 20, 2020
5e2c1b1
Merge pull request #2 from ankitdobhal/master
arjuaman Aug 20, 2020
e8260fe
Merge pull request #142 from Namyalg/Amazon-product-price-tracker
powerexploit Aug 20, 2020
bc5cce3
Merge pull request #150 from muskangoyal06/master
powerexploit Aug 20, 2020
2f5727f
Merge pull request #101 from PatelKeviin/email-client-issue94
powerexploit Aug 20, 2020
0f4827d
Merge pull request #176 from ryuk156/BASIC_OPENCV_1
powerexploit Aug 20, 2020
fc9c982
Merge branch 'master' into sharur7-HCTA
powerexploit Aug 20, 2020
d162e34
Merge pull request #168 from sharur7/sharur7-HCTA
powerexploit Aug 20, 2020
e07e691
Added changes to watermark PDF as per PR review
GudlaArunKumar Aug 20, 2020
c9d9fe7
removed spaces
ryuk156 Aug 20, 2020
b8f001f
Gets Input from user
Nagasuruthika Aug 20, 2020
b190a6f
change raw_input to input
komaldevnani Aug 20, 2020
f6b11f4
Changed suggested changes
Nagasuruthika Aug 20, 2020
be9b752
changed stem of the tree
Nagasuruthika Aug 20, 2020
c69918d
updated code
Nagasuruthika Aug 20, 2020
7d5c615
Removed space
Nagasuruthika Aug 20, 2020
1739f0d
Added Geocoding and Reverse geocoding
AdityaJ7 Aug 21, 2020
25a6263
Merge pull request #177 from ryuk156/CAR_DETECTION_1
powerexploit Aug 21, 2020
338dd28
Merge pull request #109 from AdityaJ7/issue-94-word_detector
powerexploit Aug 21, 2020
ba12c2a
added files
Aug 21, 2020
1506181
Update README.md
ryuk156 Aug 21, 2020
41bceb0
Update Qr_scanner.py
ryuk156 Aug 21, 2020
aa63f36
Added Geocoding and Reverse Geocoding to Basic Scripts
AdityaJ7 Aug 21, 2020
8b49183
Update count_positive_and_negative.py
kapilkumar2001 Aug 21, 2020
f635081
Update README.md
AdityaJ7 Aug 21, 2020
32ead4e
updated script
amandp13 Aug 21, 2020
23f0292
delete incomplete file
amandp13 Aug 21, 2020
a324bce
Merge pull request #126 from Nagasuruthika/pattern
SKAUL05 Aug 21, 2020
d7681e6
Merge pull request #180 from komaldevnani/to-camel-case
SKAUL05 Aug 21, 2020
db9184c
Merge pull request #174 from GudlaArunKumar/WatermarkPDF
SKAUL05 Aug 21, 2020
732f842
Update quad_equation.py
prasadvpatil Aug 21, 2020
4809e66
changes requested
amandp13 Aug 21, 2020
9c74426
Merge branch 'ch20new' of https://github.com/amandp13/Awesome-Python-…
amandp13 Aug 21, 2020
cf44168
Update geocoding_and_reverse_geocoding.py
AdityaJ7 Aug 21, 2020
f10edfe
Update README.md
AdityaJ7 Aug 21, 2020
a6363da
Added sample screenshot
AdityaJ7 Aug 21, 2020
edb8c48
created function
Nagasuruthika Aug 21, 2020
5c5c5fe
I have updated the required changes.
ultraUnicorn74 Aug 21, 2020
964567f
changed num and index
Nagasuruthika Aug 21, 2020
e88c11c
updated code
ultraUnicorn74 Aug 21, 2020
5a3ca56
udated code
ultraUnicorn74 Aug 21, 2020
cb2fbdc
updated code
ultraUnicorn74 Aug 21, 2020
6bcb9ad
Merge pull request #119 from Nagasuruthika/mylist
SKAUL05 Aug 22, 2020
9f16340
Merge pull request #189 from AdityaJ7/geocoding-and-reverse-geocoding
SKAUL05 Aug 22, 2020
b3a5b13
Merge pull request #131 from richabh456/dev
SKAUL05 Aug 22, 2020
487b8db
Update quad_equation.py
prasadvpatil Aug 22, 2020
d8b8abd
Update quad_equation.py
prasadvpatil Aug 22, 2020
0bb36ba
Update quad_equation.py
prasadvpatil Aug 22, 2020
ff66411
Update quad_equation.py
prasadvpatil Aug 22, 2020
a453363
Update Basic-Scripts/quad_equation.py
prasadvpatil Aug 22, 2020
af753ff
Update quad_equation.py
prasadvpatil Aug 22, 2020
435cb0d
Update Qr_scanner.py
ryuk156 Aug 22, 2020
2c6fa01
Create Password checker
Gaurav451 Aug 22, 2020
2f33a65
Merge pull request #152 from prasadvpatil/prasadvpatil-patch-1
SKAUL05 Aug 22, 2020
ef5e1ba
Merge pull request #3 from ankitdobhal/master
kaustubhgupta Aug 22, 2020
daeb39b
Reddit Scrapper all files
kaustubhgupta Aug 22, 2020
8b07541
Update count_positive_and_negative.py
kapilkumar2001 Aug 22, 2020
9df9873
compress_the_string.py
Vaibhavabhaysharma Aug 22, 2020
27fd81a
Apply suggestions from code review
Adityanagraj Aug 22, 2020
806a618
Update Basic-Scripts/staicase_pattern.py
Adityanagraj Aug 22, 2020
ef71100
Update staicase_pattern.py
Adityanagraj Aug 22, 2020
ffad47a
Update staicase_pattern.py
Adityanagraj Aug 22, 2020
87c3f52
Merge pull request #181 from ryuk156/IMAGE_CROP_1
powerexploit Aug 22, 2020
74bac7d
Github code opener from cli
komaldevnani Aug 22, 2020
22e35d8
Merge pull request #3 from ankitdobhal/master
arjuaman Aug 23, 2020
f49b714
Selection sort
arjuaman Aug 23, 2020
94f8988
This is a text based blackjack game between one player and an automat…
AakritiKinra Aug 23, 2020
f0ca46d
Delete Password checker
Gaurav451 Aug 24, 2020
b91b9d6
Add files via upload
Gaurav451 Aug 24, 2020
672dfa4
Required changes done
kaustubhgupta Aug 24, 2020
7b2ac8a
Rename Password Checker.py to password_checker.py
Gaurav451 Aug 24, 2020
4dc1304
Update README.md
Gaurav451 Aug 24, 2020
fc817a4
Update README.md
Gaurav451 Aug 24, 2020
ab69c89
Update password_checker.py
Gaurav451 Aug 24, 2020
149b024
Improve documentation
komaldevnani Aug 24, 2020
22aa4ad
Improve documentation
komaldevnani Aug 24, 2020
7ad8247
Merge pull request #170 from kapilkumar2001/new_branch
powerexploit Aug 24, 2020
c09c4ba
Added docstring and it now takes input from user
arjuaman Aug 24, 2020
f27b765
Create README.md
rutujadhanawade Aug 26, 2020
793ad59
Add files via upload
rutujadhanawade Aug 26, 2020
80fecc5
Create output
rutujadhanawade Aug 26, 2020
933dc53
Add files via upload
rutujadhanawade Aug 26, 2020
bcaa287
Delete Imdb
rutujadhanawade Aug 26, 2020
9f28d7f
Rename Web-Scraping/IMDB_TopMovies/imdb.csv to Web-Scraping/IMDB_TopM…
rutujadhanawade Aug 26, 2020
9ec0c74
added required changes
rutujadhanawade Aug 26, 2020
10e2e18
Merge pull request #215 from rutujadhanawade/master
SKAUL05 Aug 27, 2020
559a854
Merge pull request #115 from abhip99/master
SKAUL05 Aug 27, 2020
db31c50
Merge pull request #149 from amandp13/ch20new
SKAUL05 Aug 27, 2020
90ee964
Merge pull request #145 from Vaibhavabhaysharma/basic_scripts
SKAUL05 Aug 27, 2020
c6fab48
Merge pull request #136 from Adityanagraj/patch-1
SKAUL05 Aug 27, 2020
a96fb18
Merge pull request #197 from Gaurav451/patch-1
SKAUL05 Aug 27, 2020
8533b26
Merge pull request #203 from komaldevnani/github-opener
SKAUL05 Aug 27, 2020
25ff53e
Merge pull request #198 from kaustubhgupta/reddit-scrapper
SKAUL05 Aug 27, 2020
9bf17fe
Merge pull request #205 from arjuaman/selection-sort
SKAUL05 Aug 27, 2020
50e22e2
Merge pull request #208 from AakritiKinra/blackjackgame_python
SKAUL05 Aug 27, 2020
04bac45
Merge pull request #140 from gulshanbaraik01/Basic---RockPaperScissor
SKAUL05 Aug 27, 2020
927a1de
Merge pull request #151 from zenit-abh/master
SKAUL05 Aug 28, 2020
2eec994
Merge pull request #188 from ryuk156/QR_SCANNER_1
powerexploit Aug 29, 2020
fdf8d61
Add files via upload
abhishek-mishra17 Aug 30, 2020
802eb0b
Add files via upload
abhishek-mishra17 Aug 30, 2020
5c817b7
Update README.md
abhishek-mishra17 Aug 30, 2020
f660c71
Update README.md
abhishek-mishra17 Aug 30, 2020
478b7a0
Delete chromedriver.exe
abhishek-mishra17 Aug 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Basic-Scripts/Compress_the_string.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from itertools import groupby
uncompressed = str(input("Enter string to compress: ")) # user input for string
print(*[(len(list(value)), str(key)) for key, value in groupby(uncompressed)]) # logic to print occurence of values in string
22 changes: 22 additions & 0 deletions Basic-Scripts/Geocoding and Reverse Geocoding/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### Geocoding and Reverse Geocoding

#### This script takes an address and return its latitude and longitude.This process is called geocoding
#### It can also perform the opposite operation that is take latitude, longitude and provide address.

#### I have used the LocationIQ website's geocoding api inorder to solve this problem.

#### In order to run this script you need to have a private token which is just a key for the api..

#### To obtain your own private token create a *free account* at https://locationiq.com/ and replace my private token with yours.

#### Remember, *don't share* your private token with anyone if you use your personal email for account creation.

#### Install the dependencies by using:

pip install -r requirements.txt

#### An Example of the script in action:

<img src="Sample.PNG" alt="Sample">


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import requests
import sys

# If you want your own private_token please refer the README file for this script.
private_token = "<Your Private Token>"

while True:
choice = input(
"Type G for geocoding , type R for reverse geocoding and type Q to quit the script:")
print()

# If the user choose to perform Geocoding
if choice.upper() == 'G':
# Base Url for geocoding
url = "https://us1.locationiq.com/v1/search.php"

address = input("Input the address: ")

# Parameters for the geocoding url
data = {
'key': private_token,
'q': address,
'format': 'json'
}

response = requests.get(url, params=data)

# To run only if we get success response
if response.status_code == 200:
latitude = response.json()[0]['lat']
longitude = response.json()[0]['lon']

print(f"The latitude of the given address is: {latitude}")
print(f"The longitude of the given address is: {longitude}")
print()
else:
sys.exit("Cant find what you where looking for")

# If the user choose to perform Reverse Geocoding
elif choice.upper() == 'R':
# Base Url for reverse geocoding
url = "https://us1.locationiq.com/v1/reverse.php"

latitude_reverse = input("Enter the latitude: ")
longitude_reverse = input("Enter the longitude: ")

# Parameters for the reverse geocoding url
data = {
'key': private_token,
'lat': latitude_reverse,
'lon': longitude_reverse,
'format': 'json'
}

response = requests.get(url, params=data)

# To run only if we get success response
if response.status_code == 200:
address = response.json()['display_name']
print(f"The address is: {address}")
print()
else:
print("Cant find what you where looking for.")

# If the user choose to Quit the program
elif choice.upper() == 'Q':
sys.exit("Thanks for using the script")

# To make sure only valid input is provided
else:
print("Please make a valid choice")
print()

#Sample Input - Output:

#If you choose Geocoding:

#Address(Input): Rashtrapati Bhavan
#Latitude(Output): 28.614458
#Longitude(Output): 77.199594

#If you choose Reverse-Geocoding:

#Latitude(Input): 28.614458
#Longitude(Input): 77.199594
#Address(Output): Rashtrapati Bhavan, Rajpath, Presidential Estate, Chanakya Puri Tehsil, New Delhi, Delhi, 110004, India
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
certifi==2020.6.20
chardet==3.0.4
idna==2.10
requests==2.24.0
urllib3==1.25.10
23 changes: 13 additions & 10 deletions Basic-Scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Basic-Scripts
Basic-Scripts is a collection of basic python scripts for newbies in python to understand basic concept of python programming.
- Data Struture in python
- Conditional
- Loop
- Exception Handling
- Algorithms
- OOP
- Class
- Object
#Basic-Scripts
Basic-Scripts is a collection of basic python scripts for newbies in python to understand basic concept of python programming.
-Data Structure in python
-Conditional
-Loop
-Exception handling
-Algorithms
-OOP
-Class
-Object



64 changes: 64 additions & 0 deletions Basic-Scripts/Rock_paper_scissor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 17 14:24:23 2020

@author: Gulshan
"""
# Function rock_paper_scissor--->
def rock_paper_scissor(num1,num2,bit1,bit2):
play_pos1=int(num1[bit1])%3 #Play Position For Player 1
play_pos2=int(num2[bit2])%3 #Play Position For Player 2
if(player_one[play_pos1]==player_two[play_pos2]):
print("Draw")
elif(player_one[play_pos1]=="Rock" and player_two[play_pos2]=="Scissor"):
print("Player one wins!!")
elif(player_one[play_pos1]=="Rock" and player_two[play_pos2]=="Paper"):
print("Player two wins!!")
elif(player_one[play_pos1]=="Paper" and player_two[play_pos2]=="Scissor"):
print("Player two wins!!")
elif(player_one[play_pos1]=="Paper" and player_two[play_pos2]=="Rock"):
print("Player one wins!!")
elif(player_one[play_pos1]=="Scissor" and player_two[play_pos2]=="Rock"):
print("Player two wins!!")
elif(player_one[play_pos1]=="Scissor" and player_two[play_pos2]=="Paper"):
print("Player one wins!!")

# Main Function To Execute Rock Paper Scissor
if __name__ == '__main__':
player_one={0:'Rock',1:'Paper',2:'Scissor'}
player_two={0:'Paper',1:'Rock',2:'Scissor'}
while(1):
num1=input("Player one, Enter your choice ")
num2=input("Player two, Enter your choice ")
bit1=int(input("Player one, Enter the secret bit position "))
bit2=int(input("Player two, Enter the secret bit position "))
rock_paper_scissor(num1,num2,bit1,bit2)
ch=input("Do you want to continue? y/n ")
if(ch=='n'):
break


'''
Output Implementation:

Player one, Enter your choice 123
Player two, Enter your choice 567
Player one, Enter the secret bit position 0
Player two, Enter the secret bit position 1
Draw

Do you want to continue? y/n y
Player one, Enter your choice 012
Player two, Enter your choice 234
Player one, Enter the secret bit position 1
Player two, Enter the secret bit position 2
Player one wins!!

Do you want to continue? y/n y
Player one, Enter your choice 345
Player two, Enter your choice 012
Player one, Enter the secret bit position 0
Player two, Enter the secret bit position 2
Player one wins!!

'''
184 changes: 155 additions & 29 deletions Basic-Scripts/Simple_calculator.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,155 @@
operation = input('''
Please type in the math operation you would like to complete:
1 for addition
2 for subtraction
3 for multiplication
4 for division
''')

num = int(input('Enter your first number: '))
num2 = int(input('Enter your second number: '))

if operation == '1':
print('{} + {} = '.format(num, num2))
print(num+num2)

elif operation == '2':
print('{} - {} = '.format(num, num2))
print(num-num2)

elif operation == '3':
print('{} * {} = '.format(num, num2))
print(num*num2)

elif operation == '4':
print('{} / {} = '.format(num, num2))
print(num / num2)

else:
print('Wrong Input! Please Try Again')
operation = input('''
Please type in the math operation you would like to complete:
1 for addition
2 for subtraction
3 for multiplication
4 for division
''')

num = int(input('Enter your first number: '))
num2 = int(input('Enter your second number: '))

if operation == '1':
print('{} + {} = '.format(num, num2))
print(num+num2)

elif operation == '2':
print('{} - {} = '.format(num, num2))
print(num-num2)

elif operation == '3':
print('{} * {} = '.format(num, num2))
print(num*num2)

elif operation == '4':
print('{} / {} = '.format(num, num2))
print(num / num2)

else:
print('Wrong Input! Please Try Again')
=======


"""The previous script becomes very boring for the user as he has to keep on typing just numbers and of wants to interact using
simple english language he is unable to do so. Also the program terminates after one execution and if the user wants to keep on
performing operations it becomes difficult.
I have tried making a more simple and interactive calculator which allows the user to input any statement for performing the tasks. """




def Calculator(num_1,num_2):
#Executing the loop infinite times as we donot know how many times the user will want to run
while(True):
choice= input("Enter what you want to perform: ")
print()

#For Addition user can type any Sentence containing word related to it and will get the output but here we are checking only for the common words
if ("addition" in choice) or ("add" in choice) or ("sum" in choice) or ("plus" in choice):
sum = (num_1) + (num_2)
print("Output....")
print("Adding {} and {} results to {}".format(num_1,num_2,sum))
print()

#For Subtraction user can type any Sentence containing word related to it and will get the output but here we are checking only for the common words
elif ("subtraction" in choice) or ("minus" in choice) or ("difference" in choice) or ("subtract" in choice):
if( num_1 > num_2 ):
diff = (num_1) - (num_2)
print("Output....")
print("Subtracting {} from {} results to {}".format(num_2,num_1,diff))
print()
elif( num_2 > num_1 ):
diff = (num_2) - (num_1)
print("Output....")
print("Subtracting {} from {} results to {}".format(num_1,num_2,diff))
print()

#For Multiplication user can type any Sentence cpntaining word related to it and will get the output but here we are checking only for the common words
elif ("multiplication" in choice) or ("product" in choice) or ("multiply" in choice):
if(num_1==0 or num_2==0):
print("Output....")
print("Multiplying {} and {} results to 0".format(num_1,num_2))
print()
elif(num_1==1):
print("Output....")
print("Multiplying {} and {} results to {}".format(num_1,num_2,num_2))
print()
elif(num_2==1):
print("Output....")
print("Multiplying {} and {} results to {}".format(num_1,num_2,num_1))
print()
else:
mul = (num_1) * (num_2)
print("Output....")
print("Multiplying {} and {} results to {}".format(num_1,num_2,mul))
print()

#For Division user can type any Sentence cpntaining word related to it and will get the output but here we are checking only for the common words
elif("division" in choice) or ("divide" in choice) or ("quotient" in choice):
if( num_1 > num_2 ):
if(num_2==0):
print("Output....")
print("Error: Please try with some other values!")

elif(num_1==0):
print("Output....")
print("Dividing {} from {} results to 0".format(num_1,num_2))
print()
else:
div = (num_1) / (num_2)
print("Output....")
print("Dividing {} from {} results to {}".format(num_1,num_2,div))
print()
elif(num_1==0 and num_2==0):
print("Infinity!")
print()
elif( num_2 > num_1 ):
if(num_1==0):
print("Output....")
print("Error: Please try with some other values!")
print()

elif(num_2==0):
print("Output....")
print("Dividing {} from {} results to 0".format(num_1,num_2))
print()
else:
div = (num_2) / (num_1)
print("Output....")
print("Dividing {} from {} results to {}".format(num_2,num_1,div))
print()

#For exiting the loop user can type any Sentence containing word related to it and it will exit from the loop but here we are checking for the common words
elif ("exit" in choice) or ("stop" in choice) or ("return" in choice):
break

else:
print()
print("Operation not found: Please try again!")
print()



def main():

print()
print(" THIS IS A BASIC USER FRIENDLY CALCULATOR! ")
print()
print("You can type a sentence and interact.")
print()
#inputting two numbers at a time using the split function
num_1,num_2 = input("Enter two numbers: ").split()
num1=float(num_1)
num2=float(num_2)


#printing both the numbers
print("Number 1 is: ",num_1)
print("Number 2 is: ",num_2)
print()

Calculator(num_1,num_2)


if __name__ == "__main__":
main()
Loading