Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DataGlacier authored Dec 23, 2020
1 parent 174c88c commit ba879ae
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions scripts/add.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#https: // github.com / DataGlacier / VC.git
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 = load_json()

def write_json(data,filename = '../response.json'):
with open(filename,'w') as file:
json.dump(data,file,indent=0)


def call_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 ba879ae

Please sign in to comment.