Skip to content

Added name and favorite sport #914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions response.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"DG": "Test",
"Data Glacier": "Cricket"
}
"name": "Rishabh Raman",
"sport": "Dallas Seadragons",
"Rishabh Raman": "Dallas Seadragons"
}
10 changes: 5 additions & 5 deletions scripts/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ 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 == ""):
if sport == "":
sport = 'Cricket'
if (name):
response[name] = sport
if name:
# overwrite response with expected format
response["name"] = name
response["sport"] = sport
write_json(response)


if __name__ == "__main__":
call_sport()

call_sport()