DEV Community

Cover image for ChatRPG - How to learn Python with AI in a funny way
Maxime Turin
Maxime Turin

Posted on • Originally published at mxmtrn.odoo.com

ChatRPG - How to learn Python with AI in a funny way

As part of my job search, I'm being introduced to a new language: Python.
As the proud owner of a primate brain on the one hand, I'm well aware of the power that gamification, in the context of learning, can have on me.
As a technophile on the other, I couldn't miss the emergence of artificial intelligence tools, notably the conversational AI phenomenon that is ChatGPT, developed by OpenAI.

How can ChatGPT help me discover Python while making the experience as fun as possible?

You can read the original French version of this Here.


FROM ChatGPT - the generalist TO ChatRPG - the Python expert

Although powerful, ChatGPT is even more so when subjected to role-playing.
So I've defined how I want ChatGPT to take charge of training me in Python, following a certain formalism to give it as much context as possible:

  • The role of the AI: ChatGPT will be a Python expert with a strong propensity for teaching.
  • What I expect from the AI: ChatGPT will have to introduce me to the most common syntax and methods of the Python language.
  • The method: in order to achieve this, I want ChatGPT to propose a series of exercises, I'll tell it I have a certain amount of knowledge (JS), and I'll ask it to provide me with external documentation so that I can explore the notions that I am learning further (and, moreover, it will allow me to check that ChatGPT isn't fooling me).
  • The way: finally, I introduce the notion of gamification of my learning, specifying my minimum expectations on this subject: (RPG, Mage, notion of xp).

Image description

Image description


Become a powerful Mage

Initially, ChatGPT provided me with a series of "exercises", even though it's called that, it's nothing more than code extracts enabling me to grasp the basics of Python syntax. As agreed, he provided me with documentation, gave me experience so that I can level up, and listed the skills acquired during this first phase.

Image description

Having reached Level 7, I asked ChatGPT to provide me with a more substantial challenge than simply copying code into my IDE.

Image description

Notice how OpenAI doubts my kindness when I ask ChatGPT to kick some ugly monsters in the teeth.

Image description

After having been congratulated on my perspicacity facing this first boss, which I easily swept aside, and then provided with a new code-copying "exercise", I had to face my first real challenges.


OMG The Data Dragon!

Image description

Unimpressed by the enemy, and helped by a good documentation, I naturally slaughtered the hot breathed creature.

Image description

This is where learning via conversational AI makes sense. ChatGPT is capable of providing an alternative solution while explaining the difference between the two proposals. We'll see a little later that it's capable of being even more complete when it comes to analyzing the code I propose.

The other advantage is the ease with which you can "shape" the conversation. This way, I was able to obtain an Artifact, and that's dopamine directly in the veins.

Image description

Yeah I claimed, so what?!?

Image description

A bit of Lore, it's always nice


The Pythonic Monster !

After a new series of exercises / lessons, a few questions about instruction 'with', a little challenge on how to throw exceptions, some article reading, and a lot of level up; I asked to take on a new monster.
ChatGPT offered me a multi-stage challenge (a succession of small algorithmic problems), with the promise of a chest full of well deserved loot :

Image description

Once again ChatGPT provides a quality correction, and is complete enough to demonstrate the advantages of its solution over mine.

Image description

Image description

What's more, I got a really cool amulet!


Make ChatRPG even more RPGed with an MCQ

At this stage of my discovery of Python with ChatGPT, I thought it would be a good idea to check that I'd acquired the concepts I'd seen previously.
So I asked the AI to generate a MCQ for me, which I included in an encounter with an NPC (non-player character), with the promise of being rewarded with a familiar if I succeeded.

Image description

So, after answering the questions of a strange but clever peasant (probably Gandalf undercover), I was able to choose a companion for the rest of my adventure.

Image description

Image description

Aware that I sometimes find it difficult to factor and optimize my code, I've chosen to fight my next battles alongside the Shadowstalker.
The beast has a whole arsenal of techniques that will enable me to be more efficient in the future.

Image description

ChatGPT lets me apply a different reading to my code according to the needs I've identified beforehand! So I can ask for specific feedback without having to define what kind of feedback I need.
Here, for example, is the first of the techniques applied to a problem I was given on a quest further along my initiatory journey: the aim of the problem was to generate all the prime numbers up to the number entered by the user.

Image description

It's got style!


Conclusion

Considering what I already knew about ChatGPT, the AI has lived up to my expectations regarding its ability to support the discovery of a new programming language.
I was, however, very enthusiastic about its ability to bring a gamification layer to the process.
Here, in no particular order, is a list of the pros and cons I encountered during my experience:

  1. Pros:
  2. Quick and easy to set up.
  3. Adaptable over time.
  4. Satisfactory progress overview.
  5. Lore is ok.
  6. Ability to correct behavior that doesn't meet your expectations.
  7. Possibility of re-launching the latest ChatGPT contribution if it doesn't suit you.
  8. "Wow, it can do that ?!" effect.

  9. Cons

  10. Commits a few errors and inaccuracies: for example, the first version of the MCQ included a question to which no answer could be given.

  11. Requires reminders from time to time: "don't forget to provide me with documentation", "give out rewards for success", "you must include my progress in the general Lore of our conversation", etc.

A few tips if you want to try out this way of learning:

  • Don't use this method on a subject you don't know too much about! If ChatGPT makes a mistake or lies to you, you won't know.
  • Give him as clear and precise information as possible.
  • Don't give it too many instructions at once. At the end of my experiment, I tried to automate the way it generates learning and challenge phases, in a prompt of around thirty lines and with sometimes complex instructions. The result? I broke everything!
  • Nothing beats the expertise of a human being! Pedagogy is a virtue that's reserved for us, the machine is currently unable to appreciate precisely what a student needs to get the most out of what he/she 's learning. If you want to be trained in the best possible conditions, call a professional.

Bonus

I asked ChatGPT to provide me with prompts to generate images using Stable Diffusion.

Image description

ChatGPT :

Image description

He's not wrong. What about copyright management for artists present in datasets used to train models ? Vast subject.

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Thanks !

Top comments (0)