A platform for beginners to learn programming in Python

栏目: IT技术 · 发布时间: 4年前

内容简介:This is a platform/course for complete beginners to teach themselves programming, specifically in Python. Currently it's very much a work in progress - please consider!You can try a demo here:The course is a fully interactive 'book' which requires the user

futurecoder

This is a platform/course for complete beginners to teach themselves programming, specifically in Python. Currently it's very much a work in progress - please consider!

You can try a demo here: https://futurecoder.herokuapp.com/

Features

The course is a fully interactive 'book' which requires the user to run code in the provided editor or shell to advance:

A platform for beginners to learn programming in Python

The code at each step is checked automatically. Common mistakes can be caught and pointed out to the student. If needed, the student can get small hints to gradually guide them to the solution:

A platform for beginners to learn programming in Python

If they're still really stuck, they can reveal the solution bit by bit:

A platform for beginners to learn programming in Python

Tracebacks are more helpful than usual, highlighting the exact operation which failed and ensuring that the right amount of context is visible for multiline statements:

A platform for beginners to learn programming in Python

Several debuggers are provided, including snoop :

A platform for beginners to learn programming in Python

birdseye :

A platform for beginners to learn programming in Python

and Python Tutor :

A platform for beginners to learn programming in Python

Contributing

While most of the groundwork is in place, there is a lot to do to make this a complete course ready for users. All kinds of help are needed and greatly appreciated.

For starters, try using the platform to see what it's like. You can go straight to the demo site and quickly sign up for an account. See thesection below if you're not sure how to use it. Please give feedback about anything that's confusing, could be done better, or doesn't work.

In the event that the demo site gets more attention than it can handle, tryrunning the code locally with the instructions below.

The easiest way to contribute concretely is to write learning material for the course. This doesn't require any expertise beyond knowing how Python works. See this issue for some guidance and join the conversation!

Beyond that, there's plenty of coding work to do on the platform, including frontend, backend, and devops work. See the list of issues for some ideas.

Running locally

  1. Fork the repository, and clone your fork.
  2. If you want to run the system using Docker, which may be easier and will more closely resemble the production environment:
    .env
    docker-compose up
    
  3. In the backend folder:
    1. Ensure the python command points to Python 3.8.
    2. Run ./setup.sh . This will:
      poetry
      
    3. Activate the virtualenv with poetry shell .
    4. Run the backend development server with ./manage.py runserver .
  4. In the frontend folder:
    1. Ensure you have recent versions of node and npm .
    2. Run npm install to download dependencies.
    3. Run npm start to start the frontend development server.
  5. Go to http://localhost:3000/accounts/login/ and login with the email " admin@example.com " and the password "admin".
  6. You should be redirected to http://localhost:3000/course/ and see the start of the course: "Introducing The Shell".

Controls

The course consists of pages and each page consists of steps . Each step requires that the user runs some code that satisfies the requirements of that step. Once they succeed, they are shown the next step. Once they complete all the steps in a page, they are shown the "Next page" button to move forward. They can click "Previous" if they want to review completed pages, but it doesn't affect their progress - any code they submit is still evaluated against the current step, and refreshing the page returns to the last page. Hopefully these basics (without the formal details) should become intuitively clear to the user as they try to use the site.

To explore the course more freely:

  1. Click the hamburger menu icon in the top left.
  2. Click Settings.
  3. Turn Developer mode on.
  4. This should give you two red buttons floating at the bottom of the screen. They change the currently active step, so you can move forward without having to complete exercises or backwards to test a step again.

At the beginning of the course only the shell is available to encourage quick exploration. After a few pages an editor is introduced to allow running full programs.

The course provides three debuggers to specially run code: snoop, PythonTutor, and birdseye. Each should only become available starting from a specific page which introduces that tool. No such page has been written yet for birdseye, so for now it's immediately available when the editor is introduced.

System overview

The UI is written in React. It communicates with the web server using the rpc function, e.g. rpc("run_code", {code, source}, onSuccess) . This eventually reaches a method in the API class, e.g. def run_code(self, code, source): .

Running code specifically sends a request from the web server to the workers master server. This forwards the request to a process associated with that user's ID, starting a new process if necessary. Every user has their own process, which holds the state of the shell or the currently running program (which may be awaiting input() ). The processes are isolated from each other and everything else, they can easily be terminated, and they have limitations on CPU time usage and file access.

After the code finishes running, it checks the Page and Step that the user is currently on, and calls the Step.check method. In most cases this is a VerbatimStep - the user is supposed to enter exactly the code in the text, using the AST to check for equality. Next most common is an ExerciseStep where a function has to pass tests and produce the same output as a given solution. The result of Step.check determines if the user succeeded and advances to the next step. It may also return a message to show the user, e.g. if they made a common mistake.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

PHP从入门到精通

PHP从入门到精通

邹天思、孙鹏 / 清华大学出版社 / 2008-10-1 / 68.00元

DVD语音视频教学光盘,22小时教学视频录像,全程语音讲解,本书实例源程序、相关素材,本书特色:基础知识—核心技术—高级应用—项目实战,268个应用实例,41个典型应用,1个项目案例,内容极为详尽,实例典型丰富。一起来看看 《PHP从入门到精通》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具