Skip to content

Commit

Permalink
Update add.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DataGlacier authored Dec 23, 2020
1 parent 4ea22bc commit 4fec745
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions scripts/add.py
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
import json, os
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# User can add name and favourite sport in response.json
# default sport Cricket will be added incase user does not provide fav sport


def load_json():

with open('../response.json') as json_obj:
response = json.load(json_obj)
return response

response = loan_json()






def write_sport():
name = input("Please add your name: ")
sport = input("Please add your favourite sports name: ")
if(sport ==""):
sport = 'Cricket'
if(name):
response[name] = sport
write_json(response)


if __name__ == "__main__":
call_sport()


call_sport()

0 comments on commit 4fec745

Please sign in to comment.