WEEE-Open / skeeelled

An e-learning platform for the modern age
https://weee-open.github.io/skeeelled
6 stars 7 forks source link

Add PythonEditor component #120

Closed sahircansurmeli closed 2 years ago

sahircansurmeli commented 2 years ago

Added PythonEditor component. I have tested it with all of the lab assignments of the first year Python course from a.y. 2020/2021, and everything seems to be working well.

Since it uses abstract syntax trees to parse the code and await inputs, there might be some rare shortcomings where the function is assigned to a different variable and called from there.

For example the following code runs without any problems:

def get_name():
    return input("Your name: ")

get_name()

However the following doesn't run:

def get_name():
    return input("Your name: ")

x = get_name
x() 
sahircansurmeli commented 2 years ago

Link to the repo of the component: https://github.com/sahircansurmeli/python-editor

sahircansurmeli commented 2 years ago

import numpy

print(numpy.e)

sahircansurmeli commented 2 years ago