Hello, checkiomates🐱👤!
This week, we elevate your data presentation by converting Python code to LaTeX for Jupyter Notebooks, master efficient code with nested list comprehensions, and test your knowledge with interactive quizzes. Our mission challenges your algorithmic skills with a Minimum Spanning Tree problem, connecting vertices with the minimum total length.
💡TIP
At every mission page, under the editor window, there is a terminal window. If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!
🏁 MISSION
Connect Stars by kurosawa4434 -
In this mission you'll have to make the Minimum spanning tree. You are given a list of coordinates of vertices. You have to return a list (or an iterable) of lines that connect all vertices. The total length of lines should be the minimum.
connect_stars([(1, 1), (4, 4)]) == [(0, 1)] connect_stars([(1, 1), (4, 1), (4, 4)]) == [(0, 1), (1, 2)] connect_stars([(6, 6), (6, 8), (8, 4), (3, 2)]) == [(0, 1), (0, 2), (0, 3)]
📖 ARTICLES
3 Tools That Automatically Convert Python Code to LaTeX Math -
Writing LaTeX by hand is not easy, especially for complex equations. In this article, you will learn how to convert Python code to LaTeX in Jupyter notebooks using four powerful tools: IPython.display.Latex, handcalcs, latexify-py, and SymPy.
Nested list comprehensions in Python can look complex, but with thoughtful whitespace, they can be pretty readable!
Ways to Start Interacting With Python Quiz -
Want to revisit different ways to run Python code interactively? In this quiz, you’ll review concepts such as using the REPL, executing scripts, and working within IDEs.
👩💻CODE SHOT
What do you think the following code does?
SeqTup = list[tuple[int, int]]
def checkio(data: SeqTup) -> SeqTup:
res = []
start = end = None
for s, e in data:
if not start:
start, end = s, e
elif s - end < 2:
end = max(end, e)
else:
res.append((start, end))
start, end = s, e
if start:
res.append((start, end))
return res
🙌 Thanks for your attention! Hope to meet you at CheckiO, as well as at our Instagram and Twitter! We are really interested in your thoughts! Please, leave a comment below! ⤵
