Does Minecraft Education Edition Python allow creation of Classes?
Does the Python editor within Minecraft Education Edition allow programming using classes? I tried to create a class and instantiate it as follows. However when I run the code nothing happens. I also do not get any error.
-
PS: In the code above the indents are present but not displayed.
0 -
Welcome fellow coder! =]
I tried this and it worked:
class MyStuff:#"""A simple example class"""i = 12345
testCase = MyStuff()say(testCase.i)0 -
Thanks Debbie,
However I am still having no luck... I am getting the following error messages for the first program:
Line 6: can't find called function "MyStuff"
Line 7: unknown object type; cannot lookup attribute 'i'0 -
You are running this in Python Azure Notebooks, not the MakeCode Python window, right?
class MyStuff:i = 12345testCase = MyStuff()say(testCase.i)0 -
Hi Debbie,
Sorry for the late response. I am using the MakeCode window in Minecraft. I do not know how to use the Python Azure Notebooks with Minecraft Education Edition. Can you please guide?
0 -
All I can get to work in MakeCode is this - no function, no instantiation, no new objects in the class - I managed to keep it from throwing syntax errors but not actually working for those. Just creating variables for a class is pretty limited capability, but here you are: (P.S. Python Azure Notebooks is great!)
class MyStuff:#"""A simple example class"""i = "Hello Classes"testCase1 = MyStuff.iplayer.say(testCase1)1 -
Thanks Debbie... The code works in Notebooks.
0 -
Hooray! I'm so glad!
0
Please sign in to leave a comment.
Comments
8 comments