Data Sandbox
To practice writing complex and interesting programs, you need data—lots of it. Entering data manually is challenging. It’s easy to enter a password or a to-do list, but writing a program to sort a list of orders is different. Even if you need just a dozen entries, it can be time-consuming and boring, distracting you from the most interesting part—programming.
To solve this problem, we created the educational module data_sandbox. Think of it as a set of useful functions written by your colleagues that you can use. In real programming, this is common—you rarely write everything from scratch; instead, you use ready-made tools.
Installation
Currently, data_sandbox is only available on the educational platform and cannot be installed via pip. We plan to change this in the future.
Usage
get_students()
Returns a list of tuples, where the first element is the student’s full name and the second is their average grade.
import data_sandbox
print(data_sandbox.get_students())
# [('John Doe', 4.5), ('Peter Smith', 3.5), ('Sid Brown', 5.0), ...]
get_rainbow_colors(num_colors=100)
Returns a list of colors (each color is a tuple of three elements), gradually changing from red to green. The num_colors parameter determines the number of colors in the list (default is 100).
from data_sandbox import get_rainbow_colors
colors = get_rainbow_colors(10) # [(1, 0.0, 0.0), (1, 0.6, 0.0), (0.8, 1, 0.0)...]
get_random_books(count=3)
Returns a list of random books.
from data_sandbox import get_random_books
books = get_random_books() # [{'title': 'Sherlock Holmes: A Study in Scarlet', 'author': 'Arthur Conan Doyle'}, ...]
Each element of this list is a dictionary that must contain the keys title and author. Optionally, it may include the keys year and publisher.
get_random_search_queries(count=50)
Returns a list of random search queries.
from data_sandbox import get_random_search_queries
queries = get_random_search_queries() # ["Why does my code work when it shouldn't?", ...]
get_settings()
Returns a dictionary with random user settings.
from data_sandbox import get_settings
print(get_settings()) # {'theme': 'dark', ...}