Text stringlengths 49 111 | Rating int64 6 9 |
|---|---|
Today around 11:30am I realized that I've only ever worked in JavaScript and am wondering if I'm cooked... | 7 |
Today I learned how to check in. I'll be working on fixing my CoLab and starting to work on any datasets missed | 6 |
Today I finally figured out how to set up GitHub repositories and push my first project... | 8 |
Today I decided to dive into Python’s object-oriented programming... | 8 |
Today I worked on fixing some bugs I encountered while trying to integrate my Unity project... | 7 |
Today I spent some time working with Python's pandas library... | 7 |
Today I explored a bit more of Unity’s animation system... | 7 |
Today I focused on practicing my JavaScript skills... | 6 |
Today I watched a series of tutorials on React... | 6 |
Today I tried out some deep learning concepts and explored TensorFlow... | 9 |
Today I spent a few hours reviewing Python’s list comprehensions and lambda functions... | 7 |
Today I spent time learning about RESTful APIs... | 7 |
Today I worked through some Git commands to get more comfortable with version control... | 7 |
Today I spent some time looking into SQL and how to work with databases... | 7 |
Today I started working on a new project that uses both Python and JavaScript... | 8 |
Today I reviewed some basics of algorithms and data structures... | 7 |
Today I spent time working through problems on LeetCode... | 8 |
Today I focused on learning about version control workflows... | 7 |
Today I worked on integrating Firebase into my app project... | 8 |
Today I explored JavaScript’s event loop and how it works with asynchronous operations... | 7 |
Today I focused on learning more about Python’s NumPy library for numerical computing... | 7 |
Today I worked on understanding how to create and use APIs in Python with Flask... | 8 |
Today I spent some time learning how to integrate third-party APIs into my projects... | 7 |
Today I tackled some more advanced Unity concepts like physics simulations and rigidbody interactions... | 8 |
Today I worked on understanding Python’s decorators and how they can be used... | 7 |
import json
data=[ {"name": "Maryah Mink", "siblings": 5, "parents": {"mom": "Mama Mink", "dad": "Papa Mink"}, "birthdate": "December 13, 2007", "age": 17, "school": "Jean Ribault High School", "favorite_color": "Pink", "best_friend": "Mr. Jett"} ]
def answer_question(data, question): question = question.lower() # Convert the question to lowercase to make case-insensitive comparisons
if "name" in question:
return data[0]["name"] # If the word "name" is in the question, return the "name" from the dataset
if "siblings" in question:
return f"Maryah has {data[0]['siblings']} siblings."
if "parents" in question:
return f"Maryah's mom is {data[0]['parents']['mom']} and her dad is {data[0]['parents']['dad']}."
if "birthdate" in question or "birthday" in question:
return f"Maryah was born on {data[0]['birthdate']}."
if "age" in question:
return f"Maryah is {data[0]['age']} years old."
if "school" in question:
return data[0]["school"]
if "favorite color" in question:
return f"Maryah's favorite color is {data[0]['favorite_color']}."
if "best friend" in question:
return f"Maryah and {data[0]['best_friend']} are best friends (BSFs)."
return "Sorry, I couldn't understand your question."
question_1 = "What is Maryah's favorite color?" question_2 = "How old is Maryah?" question_3 = "Who are Maryah's parents?" question_4 = "When is Maryah's birthday?" question_5 = "Who is Maryah's best friend?"
print(answer_question(data, question_1)) print(answer_question(data, question_2)) print(answer_question(data, question_3)) print(answer_question(data, question_4)) print(answer_question(data, question_5))
Convert to DataFrame
df = pd.DataFrame(data)
Save as JSON
df.to_json("FamHistory_dataset.json", orient="records", lines=True)
Convert to JSON string
json_data = json.dumps(data, indent=4) # Pretty print with indentation
Print JSON output
print(json_data)
- Downloads last month
- 3