I tried using the checkio API

Article Summary: checkio-client allows you to solve checkio problems even if you're not in a browser

Background

What is checkio?

checkio is a Python and Typescript learning service (or rather a coding game?). The characteristic point is that questions that emphasize practicality are asked. For example, instead of "the problem of detecting a specific character string using a regular expression", "the problem of selecting emails that are difficult to handle" Questions will be given in the form of. Unlike general teaching materials that let you learn one knowledge per question, the difficulty level is generally high because one basic problem requires various knowledge (sometimes even the lowest difficulty level Elementary cannot be solved. (Dent) definitely contributes to improving the quality and motivation of learning. It's great to be able to share your answers with others.

Although it is a convenient service, it has one problem. ** The answer screen is messed up and hard to use. ** ** I type the script into an editor on the Web, but since the command completion function is not provided, I often forget to close the typo and parentheses, and code that does not follow pep8 frequently. Debugging work is also difficult. It's bad that I usually rely on the completion function of vscode, but I don't want to devote my thinking resources to correcting such mistakes one by one. What to do with the result ** I wrote a script in vscode, debugged it, and if it worked, I copied it to the answer screen of the browser **.

If you have such a useless process, please send the script file and answer it ... ↓ You can send py files with API!

I learned the fact for the first time after using checkio for 2 years, so I will introduce it here.

Things to prepare

Installation

1. Install checkio_client (API)

pip3 install checkio_client

2. Set config

checkio config
Which domain you want to use by default? (code required)
[py] - https://py.checkio.org
[js] - https://js.checkio.org
[epy] - https://empireofcode.com
[ejs] - https://empireofcode.com
by default:py
Code for domain[py]:

Since python is used, enter as it is


What is your KEY for https://py.checkio.org ?
You can find one on https://py.checkio.org/profile/edit/
KEY:

Enter API key


Choose folder for your solutions [/home/user/py_checkio_solutions]:

Enter the directory where you want to save the file (default is ok)

3. Synchronize progress

checkio sync ~/py_checkio_solutions

Unzipped files are synced to the specified directory dir_tree.png

From the second time onwards

checkio sync

You can just sync.

How to Use

1. Write the answer to the py file

Write the answer to the synchronized py file. Since the question text is also described in the file, there is no need to open the question text in the browser.

2. Test the answer

If the assert statement passes, send the answer and test

When solving Zigzag Array

zigzag_array.py --check
Start checking...

*** Basics ***
->[3, 5]
<-[[1, 2, 3, 4, 5], [10, 9, 8, 7, 6], [11, 12, 13, 14, 15]]
->[5, 1]
<-[[1], [2], [3], [4], [5]]
->[3, 3, 5]
<-[[5, 6, 7], [10, 9, 8], [11, 12, 13]]
*** Extra ***
->[0, 3]
<-[]
->[3, 0]
<-[[], [], []]
->[0, 0]
<-[]
->[10, 1]
<-[[1], [2], [3], [4], [5], [6], [7], [8], [9], [10]]
->[4, 2]
<-[[1, 2], [4, 3], [5, 6], [8, 7]]

!!! Congratulation !!!

Link for checking solution of other users: https://py.checkio.org/mission/zigzag-array/publications/

Link for sharing solution: https://py.checkio.org/mission/zigzag-array/publications/add/

Pass the test when Congratulation is displayed.

3. Post the answer

Access the link for Link for sharing solution and submit your answer Posting is complete when a notification such as "Shared Clear solution ..." is displayed in Activity on the user page.

in conclusion

It is very convenient because you can complete the process of "selecting a problem-> solving-> testing" on vscode.

If you want to know more about checkio-client, please refer to the official blog. https://py.checkio.org/blog/new-tool-checkio-client/

There seems to be a browser extension, but I don't feel like using it much because the review score is low and the last update is terrible at the end of 2018 (as of June 2020). http://www.checkio.org/local-editor/chrome/extension/

Recommended Posts

I tried using the checkio API
I tried using the BigQuery Storage API
I tried using the Google Cloud Vision API
I tried the Naro novel API 2
I tried using the API of the salmon data project
I tried the Naruro novel API
[Python] I tried collecting data using the API of wikipedia
[For beginners] I tried using the Tensorflow Object Detection API
I tried using Twitter api and Line api
I tried using YOUTUBE Data API V3
I tried using UnityCloudBuild API from Python
I tried to touch the COTOHA API
I tried using parameterized
I tried using argparse
I tried using mimesis
I tried using anytree
I tried using aiomysql
I tried using Summpy
I tried using coturn
I tried using Pipenv
I tried using matplotlib
I tried using "Anvil".
I tried using Hubot
I tried using ESPCN
I tried using openpyxl
I tried using Ipython
I tried using PyCaret
I tried using cron
I tried using ngrok
I tried using Jupyter
I tried using PyCaret
I tried using Heapq
I tried using doctest
I tried using folium
I tried using jinja2
I tried using folium
I tried using scrapy for the first time
I checked the library for using the Gracenote API
I tried using Remote API on GAE / J
I tried hitting the Qiita API from go
vprof --I tried using the profiler for Python
I tried using PyCaret at the fastest speed
I tried to touch the API of ebay
I tried using the Datetime module by Python
I tried to summarize various sentences using the automatic summarization API "summpy"
[I tried using Pythonista 3] Introduction
I tried using easydict (memo).
I tried face recognition using Face ++
I tried using Random Forest
Try using the Twitter API
I tried using BigQuery ML
I tried using Amazon Glacier
I touched the Qiita API
Try using the Twitter API
I tried the changefinder library!
I tried using git inspector
Try using the PeeringDB 2.0 API
[Python] I tried using OpenPose
I tried using magenta / TensorFlow
I tried using AWS Chalice
I tried using Slack emojinator