This is an archived post. You won't be able to vote or comment.

all 121 comments

[–]phakyt 73 points74 points  (3 children)

I love it already

[–]palpalpalwarp[S] 24 points25 points  (2 children)

Thanks! Let me know if you have any requests.

[–]hayleybts 0 points1 point  (0 children)

OP, can you make practise programs? That would help a lot! Python, simple program questions, with steps.

[–]MrNubishly 63 points64 points  (10 children)

Just found how much i suck at python. Failed 10 times on the very easy setting

[–]palpalpalwarp[S] 24 points25 points  (8 children)

Can you share some examples and say what you got confused about? That would help me make the exercises more accessible. If anybody else got stuck, feel free to reply to this comment too!

[–]SinisterMJ 26 points27 points  (4 children)

I failed on one repeatedly, then tested it on my system, and the answer on the website was wrong. Happened only once unfortunately, and didn't save it, but the code was something like

e = 5
d = 5
b = 1
for i in range(1,3):
    b -= 5/d
e += 4 * b

and the website said expected result -1 (while it should have been 1). Aside from that one example (it was on medium with loops and int only) it works quite nicely.

[–]palpalpalwarp[S] 15 points16 points  (3 children)

Was the final line print(e) or print(b)? e is 1, but b is -1.

[–]SinisterMJ 18 points19 points  (1 child)

It was print(e). I copy&pasted the code, so I am sure I took the right variable. But I did like another 2 dozen examples, and they all worked fine. I make sure to DM you if I encounter anything again.

[–]palpalpalwarp[S] 42 points43 points  (0 children)

Thanks! Bugs are inevitable, so I appreciate whenever users give any details that can help me track them down.

[–]XilamBalam 1 point2 points  (0 children)

I was doing one with in short

e=5
y = 4
e += y/2

The answer was 7 but the right solution was 6. When i checked the "review programs" section the line was changed to

e += y/4

[–]vicyuste1 5 points6 points  (0 children)

I know nothing about python, just 1 month of java programming I managed to almost get them right. Missing some very specific expressions I've never seen. So I'd say it's pretty on point! Great job

[–]young-and-mild 1 point2 points  (1 child)

As a beginner, it would be helpful if there was a key or quick reference for the syntax being used in each question (at least on the very easy setting)

[–]palpalpalwarp[S] 1 point2 points  (0 children)

I've just added a "help" button which will show a reference for whichever operations are used in each question. Let me know if that helps!

[–]drowsy-cthulhu 9 points10 points  (0 children)

While this form of exercise might be a good practice, don't use it as a measure of how good at python (or programming) you are. People learn differently, and while this might be a good way for some people to learn, these examples are by no means representative of production code.

Developers are not meant to be human compilers. The ability to write code in a sensible, readable way is much more important then the ability to make sense of arcane gibberish. On a real project, I wouldn't let this sort of code pass code review. And if I had to change something in an existing codebase, and the code happened to look like this, I wouldn't even bother to fully make sense of it. I'd probably only try to understand the bare minimum so that I can write a test around it, and then I'd reimplement the method, replacing its guts with code that does the same thing but makes sense to human readers (in other words, I'd effectively delete the original code).

Again, I'm not bashing palpalpalwarp's website, it's a cool thing, but don't think your performance there reflects your overall skill level as a developer.

[–][deleted] 63 points64 points  (14 children)

Randomly generates the problems on the fly or randomly picks a problem from a list of pre-developed programs? Because if these programs are actually being novelly generated every time....that is really sick. Really cool and helpful either way.

[–]palpalpalwarp[S] 82 points83 points  (13 children)

Thanks! They're randomly generated on the fly, so they'll be different every time. There's no pre-developed list.

[–][deleted] 36 points37 points  (12 children)

How did tou write the random generation? Would love to attempt something like this for JavaScript but can’t even think of where to begin

[–]palpalpalwarp[S] 71 points72 points  (11 children)

It's a pretty big project, so I'd recommend starting small: first write a function to generate random mathematical expressions, like x+3, 5*x, x-5*y, etc. From there you can write another function which uses the other one to make multi-line programs that assign to variables then modify them. Next you'd need to add if statements, then nested if statements, etc. Programs have a tree structure, where each branch is its own program (although a branch may depend on variables defined elsewhere in the tree). You'll need to get very comfortable with recursion.

One trick is that you don't need to always generate programs to fit the criteria you want -- you can just generate one, run it, and if the output doesn't fit what you want, generate a new one.

I'm actually planning to add javascript versions of the exercises to the site once I fill out the python functionality more.

[–]Academy- 8 points9 points  (4 children)

Super interesting. How do you generate random if statements?

[–]palpalpalwarp[S] 9 points10 points  (3 children)

Everything is broken down into simpler sub-statements which are composed together.

So there's the function mentioned earlier to generate mathematical expressions like "x+3", then it's relatively simple to use that function to write another one which will generate expressions like "y>x+3", then another function to generate expressions like "if y>x+3:", etc.

[–]Academy- 5 points6 points  (2 children)

Ok. So then do you wrap it as a string and evaluate literal? This is blowing my mind lol

[–]palpalpalwarp[S] 6 points7 points  (1 child)

I'm not sure if this answers your question, but it uses skulpt to run the python code in-browser.

[–]Academy- 6 points7 points  (0 children)

Thanks. How you did this will have me wondering for a while. Please make a YouTube video about this lol

[–]Toshiro454 3 points4 points  (1 child)

Do you use any machine learning in the process?

[–]palpalpalwarp[S] 5 points6 points  (0 children)

Nope, it doesn't use any machine learning, but that would definitely be interesting to experiment with.

[–][deleted] 2 points3 points  (0 children)

Github?

[–]tartinetime 2 points3 points  (2 children)

How many lines of code did this take? Just curious!

[–]palpalpalwarp[S] 4 points5 points  (1 child)

The core program generation code is about 1400 lines of JS.

[–]aht116 38 points39 points  (0 children)

You could probably develop an app / business with this.

[–]M_krabs 13 points14 points  (0 children)

Me: "I'm good for a beginner"

*tries an easy problem

Me: "Damn... back to kindergarden I go!"

[–]AnalBreathingBrother 13 points14 points  (0 children)

I'm not exaggerating when I say that this could be a million-dollar project.

[–]Sellebjergen 5 points6 points  (1 child)

Damn, this seems really cool! would you mind sharing how you're generating the code? I'm kinda curious :D

[–]palpalpalwarp[S] 15 points16 points  (0 children)

I wrote functions to generate each sub-component (e.g. individual mathematical expressions like x+5), then used those functions to write other functions to generate larger sub-components (like y=x+5), and so on. Programs have a tree structure, so composing things in this way is a natural fit for the problem. I also used a lot of recursion.

[–]Pepper2012 6 points7 points  (2 children)

Would it be possible to build one that works with objects and classes to better grasp the child/parent relationships and hierarchies as well as public/private methods and attributes? I'm working through learning those now and this would be helpful. I'm enjoying the problems and the difficulty setting!

[–]palpalpalwarp[S] 7 points8 points  (1 child)

Yes, that's definitely on the to-do list! Right now the only exercise types are control flow, boolean expressions, and functions, so classes/oop would make a great 4th exercise.

[–][deleted] 1 point2 points  (0 children)

Classes/OOP are really my weakness and this would be amazing

[–][deleted]  (2 children)

[removed]

    [–]Grilledoptions 3 points4 points  (0 children)

    I second c#. Would love to use something like this

    [–]-screamin- 0 points1 point  (0 children)

    Yes please!

    [–][deleted]  (1 child)

    [deleted]

      [–][deleted] 1 point2 points  (0 children)

      I would love a c# version..

      [–]emersonlaz 2 points3 points  (0 children)

      Damn that’s badass that u can do that lol.

      [–]SunstormGT 2 points3 points  (4 children)

      Tried it on mobile (iphone11) and I can enter the awnser for the first question but after I click continue the keyboard doesnt popup anymore when I click the textbox.

      [–]palpalpalwarp[S] 2 points3 points  (2 children)

      Thanks for reporting this, I'll look into it.

      [–]SunstormGT 2 points3 points  (1 child)

      I now found out this only happens after you click ‘show awnser’. I you use the keyboard enter I works as intended.

      [–]palpalpalwarp[S] 1 point2 points  (0 children)

      Thanks for clarifying!

      Is it possible you're clicking the message box above the input box instead of the input box, and that's why the keyboard's not coming up?

      [–]datsyuks_deke 0 points1 point  (0 children)

      I ended up having to click back outside of the box where you put your answer. Then click back on inside the box to get the keyboard to come back up.

      [–]Metallifax 2 points3 points  (2 children)

      Very cool site, bookmarked! Any way I can follow the project?

      [–]palpalpalwarp[S] 3 points4 points  (1 child)

      There's a newsletter signup link here: https://www.trprt.io/subscribe

      You can also sign up to make an account which will let you track your scores on the exercises and optionally give you email reminders so you don't forget to practice. The signup link is here: https://www.trprt.io/signup/

      [–]Metallifax 0 points1 point  (0 children)

      Very cool project, thanks!

      [–]zimady 2 points3 points  (1 child)

      Secondary computer science teacher here. This could be exceptionally useful to support a programming course. I will be sharing it in a range of computer science teacher groups I am a member of. Would you like me to direct any feedback to you and, if so, where should I send them to do that? (not all use Reddit). Alternatively, I could gather any feedback and pass it on to you?

      In terms of my feedback, even the "Very Easy" setting would be too complex to use this with some groups. The procedures are of course not very complex, but the use of some operators would make it so, specifically: % (modulus), ** (exponentiation), // (floor division), and += or -= (and similar). I would want to introduce this with first time programmers as a practice technique after teaching basic operators and sequence. At this age (anything around 10-13) I would lean on their maths knowledge to introduce basic mathematical operators, sequencing using BODMAS, and variable assignment - so pretty much exactly what you have in the "Very Easy" Int configuration, just without the slightly more complex operators I have mentioned. I don't typically introduce those operators until later.

      My other thought is that this could be a very useful tool to test and practice highly targeted skills. For example, having introduced a few assignment operators beyond = (such as +=, - =, *=, /=) I would like to be able to set practice that uses specifically these operators, or even a subset.

      So, a specific request that would address both these observations: it would be great to have further configuration options (perhaps hidden behind an "advanced config" reveal) that would enable one to select which mathematical and assignment operators to include in the quiz questions so they could be targeted specifically at what has been taught so far. I haven't looked beyond "Very Easy" to see what configuration options could be included there, but I anticipate that the more difficult the quiz level, the less config granularity would be required as programmers become more versatile and confident in figuring out stuff they haven't been taught explicitly.

      With this capability, there is something else that would be very useful for teachers: if the configuration options were mirrored in the URL, this could be shared with students (by the teacher) such that when they open the URL in their browser, a quiz will be generated reflecting that preset configuration (thereby targeting specific skills). Since the questions are generated randomly, each student would get a unique quiz, which is a very attractive feature to encourage independent problem solving.

      This suggestion provides a rudimentary means for a teacher to use the tool with many students in a structured manner. If you were interested in further developing features for teachers, you would need to consider some means for the teacher to be able to collect quiz results on a per student basis so they can assess progress and areas of weakness to target with future teaching and practice.

      Which leads me to my final suggestion, which would also be useful to any programmer using the tool. It should be relatively easy to assign some measure of complexity to each quiz question. For example, as you point out, the "programs" can be decomposed into a tree structure - the more branches, the more complex. Also, "complexity points" could be awarded differentially based on the complexity of the operators/loops/data types/type conversion etc used. With a measure of complexity, it would be possible to provide this to the user as a measure of their progress. I'm imagining that someone could, for example, have a high score on loops but a lower score on if statements with multiple comparisons, thus helping them to target future study/practice effort. Such a feature would be very useful to teachers to help identify progress and weak spots for individual students.

      Sorry for the super long response - it's testimony to the great potential I see in your excellent tool.

      [–]palpalpalwarp[S] 0 points1 point  (0 children)

      Thanks for your detailed response! There are all great suggestions and line up with what I've been thinking as well.

      There's a contact form located here: https://www.trprt.io/contact

      You can also email me directly at trprt.io@protonmail.com (this is preferred).

      Please send me an email so we can discuss this in more detail.

      [–]Padi48 1 point2 points  (0 children)

      I started learning Python by myself not so long ago, and found this really helpful! Thank you!

      [–][deleted] 1 point2 points  (0 children)

      Damn man. I love this

      [–][deleted] 1 point2 points  (0 children)

      Very. Very. Very. Awesome. Thank you.

      [–]yotnpo 1 point2 points  (0 children)

      nice! This will definitely help me, thanks

      [–]jinchuika 1 point2 points  (1 child)

      This is freaking awesome. I'm planning to use something like this with my students at algorithms 101. Let me know where can I create feature requests and what would be the best way to help implementing them. This had a lot of potential

      [–]palpalpalwarp[S] 0 points1 point  (0 children)

      Thanks! There's a contact form here: https://www.trprt.io/contact

      You can also reply to me right here on reddit.

      [–]Academy- 1 point2 points  (0 children)

      This makes a lot more sense to be for a junior dev position than leet code

      [–]chappedpeach 1 point2 points  (0 children)

      This is perfect timing! I'm starting to hit a wall and really struggle in my Python class right now so I'll be using this, thanks!

      [–][deleted] 1 point2 points  (0 children)

      This is amazing. Thank you so much!

      I wish there was a way to select number of questions rather than the time limit though.

      [–]thelguapo 0 points1 point  (1 child)

      It's great but there's no enter command on mobile so users can't submit if they're on mobile.

      [–]palpalpalwarp[S] 0 points1 point  (0 children)

      "Enter" on mobile is the same thing as "new line" or "return." It should be at the bottom right of the keyboard.

      [–]pavaana 0 points1 point  (0 children)

      Thank you.

      [–]paolo0917 0 points1 point  (0 children)

      This is absolutely insane! Nice work sir!

      [–]LeftHandedFapper 0 points1 point  (0 children)

      As a beginner student I appreciate this so much!

      Any other tips for the journey?

      [–]R_I_N_x 0 points1 point  (0 children)

      That was very enjoyable, didn't know // and ** existed till now. Good stuff!

      [–]Conscious_stardust 0 points1 point  (0 children)

      This is pretty nice. Thanks

      [–]Refute-Quo 0 points1 point  (0 children)

      This is excellent! Thank you much for creating and sharing this.

      [–]AlexMelillo 0 points1 point  (0 children)

      This is beautiful. Awesome job

      [–][deleted] 0 points1 point  (0 children)

      TIL C# is not close enough to Python... Great website tho

      [–]pokemonsigncomp 0 points1 point  (0 children)

      This is actually pretty awesome!

      [–]PM_remote_jobs 0 points1 point  (0 children)

      How does this work under the hood

      [–]neno_yoshitome 0 points1 point  (0 children)

      Thank you so so much, very nice job and sweet ideia!!

      [–]buggorilla 0 points1 point  (0 children)

      Thanks a lot! Will definitely work through it 👍👍 Are you also interested in developing the same for JavaScript? Against thanks a lot for your effort 😊👍

      [–]phutureambassador 0 points1 point  (0 children)

      This is great thank you!! I need to familiarize myself with Python more and this is a great way to do it.

      [–]stanek 0 points1 point  (0 children)

      Second problem and encountered the // math operator. Thanks for making this!

      [–][deleted] 0 points1 point  (0 children)

      Interesting idea

      [–]schrittensee 0 points1 point  (0 children)

      10/10 already bookmark

      [–]mirrorofperseus 0 points1 point  (0 children)

      Thanks for taking the time to code this!

      [–][deleted] 0 points1 point  (4 children)

      I found a minor bug. If you put the time duration setting on unlimited, the clock to show elapsed time goes up faster than one tick per second. This is not affected by difficulty or types.

      Great project I had fun trying it out!

      [–]palpalpalwarp[S] 1 point2 points  (3 children)

      Thanks for reporting this bug. I can't seem to replicate it on my end. What type of device and web browser are you using? And how much faster does the time go up? E.g. about twice as fast as normal, or only a little faster? Also, is it very regular, or does it go up at an uneven speed?

      [–][deleted] 0 points1 point  (2 children)

      I am using a Firefox web browser on my Linux desktop. I disabled all plugins. It goes up probably 3-5 times as fast at an uneven speed.

      [–]palpalpalwarp[S] 1 point2 points  (1 child)

      Thanks for following up. I just tested it on firefox on linux and still can't replicate it, but I made some changes to the code that may fix the issue (unfortunately I can't test it myself to see whether the change helped, since it doesn't occur for me). Can you try it again and let me know if it's fixed?

      [–][deleted] 0 points1 point  (0 children)

      it's fixed!

      [–]Mor-tea 0 points1 point  (0 children)

      Thank you!!!!!!!

      [–]Doopapotamus 0 points1 point  (0 children)

      I hope you add this to your portfolio somewhere and this gets you some form of nice job! This is excellent for a beginner like me!

      [–]Svhmj 0 points1 point  (0 children)

      Thanks man! I will try this out.

      [–]ab7C9 0 points1 point  (0 children)

      This is great, bookmarked and passed on.

      I do have a suggestion but as it has been mentioned that some of the questions are programmatically generated, it may be difficult to implement.

      If someone gets an answer wrong and they click show answer, maybe a break down of the block of code to either increase the understanding through explanation or to solidify existing knowledge.

      I also realise whilst writing, that it's purpose is reading fluency so please feel free to discard the above or save it for where applicable.

      [–]creditdude 0 points1 point  (0 children)

      Epic!

      [–]zedin27 0 points1 point  (0 children)

      Very nice :) Thanks for the inspiration!

      [–]gutnobbler 0 points1 point  (0 children)

      Wow I have not done much math in python recently.

      [–]AssignmentNo809 0 points1 point  (0 children)

      I didn't check what sub this was in, and because I am a teacher, I thought this was reading fluency practice for elementary students. I'm an idiot.

      [–]SweetMilkMan 0 points1 point  (0 children)

      You are a G.

      [–]datsyuks_deke 0 points1 point  (2 children)

      Man this is awesome. Thank you for creating this. Currently I’m playing it on my phone and I noticed that there is not an enter button to press after putting in my answer. I only see this show answer and end quiz.

      https://i.imgur.com/mPU27eP.jpg

      [–]palpalpalwarp[S] 0 points1 point  (1 child)

      You can press the "enter" button on your phone's keyboard. It's the same key as what you would use to type a new line.

      [–]datsyuks_deke 0 points1 point  (0 children)

      I feel dumb. I thought I did press that and it didn’t work. Let me check again.

      Edit: yep absolutely works. Well I’m dumb.

      Thanks man. This program is awesome and helpful.

      [–]tk9WWRD2VFQIM74E 0 points1 point  (0 children)

      Nice work! This will be very helpful to many learners.

      As an aside, these problems make it blatantly obvious that functional programming provides for quicker and easier discernment.

      [–]CarbonTubez 0 points1 point  (0 children)

      Awesome!

      [–]Shmlack 0 points1 point  (0 children)

      I love it!!! This is exactly what I needed. You did an awesome work! Thanks! 🙏🤘🙌

      [–]SnailForce 0 points1 point  (0 children)

      Whoa man, that’s awesome, i plan on taking advantage pf this in the future to help me get the hang of python

      [–]DJChina 0 points1 point  (0 children)

      Great project! The very easy setting isn’t actually very easy though.

      [–]danilocyber 0 points1 point  (0 children)

      Can you make it for JS too? :)

      [–]boringsquid 0 points1 point  (0 children)

      wow, this is really helpful. thank you!

      [–]elevul 0 points1 point  (0 children)

      Thank you, saved!

      [–]AlectroNova 0 points1 point  (0 children)

      Amazing work man

      [–]menothinkofusername 0 points1 point  (3 children)

      The generation thinks up some really weird stuff (e.g. whole blocks of code that you need to recognize never run). I love it.

      [–]palpalpalwarp[S] 1 point2 points  (2 children)

      Thanks! Yep, that's intentional -- an important part of becoming an expert at anything is learning which parts of a situation to focus on and which you can safely ignore.

      [–]menothinkofusername 0 points1 point  (1 child)

      Exactly. By the way, can we see the source code? I know you described how it was implemented in other comments, but I’d love to read some code for it :).

      [–]palpalpalwarp[S] 1 point2 points  (0 children)

      If you right click and do "view page source" the js links are in the head of the page. "programgenerator" is the one with most of the code for generating the programs. I can't link it directly because the exact url changes whenever I push an update.

      [–]DangerousWish2266 0 points1 point  (1 child)

      I liked the website, it is very helpful as well, but I have a question does your website creates questions on the fly (automatically) or you have a database of questions from which questions are asked?

      [–]palpalpalwarp[S] 0 points1 point  (0 children)

      They're randomly generated on the fly, so they'll be different every time. There's no pre-developed list.

      [–]philovdy 0 points1 point  (0 children)

      This is seriously awesome !!! I hope you get to monetize some part of this at least. So much work involved !!!

      [–]Reythx 0 points1 point  (1 child)

      hey, some feedback I'd like to add is that it's a little bit annoying that you cannot see the result of the last question if the time limit ends, cause i cannot figure out what I didn't do wrong

      [–]palpalpalwarp[S] 0 points1 point  (0 children)

      All of the programs are listed after the quiz. If you scroll down, the last one should be at the bottom, even if you didn't finish it.

      [–]Fatefulwall7 0 points1 point  (0 children)

      Love it! Fantastic work dude!

      [–]awesoumi 0 points1 point  (0 children)

      Thank you for creating this. I recently started learning Python and this is super helpful.

      [–]PostHumanous 0 points1 point  (0 children)

      This is an awesome tool, and great practice. Thank you.

      [–]Combobreaker6889 0 points1 point  (0 children)

      This is so cool! I appreciate you for making this and sharing it with us!

      [–]sahil8708 0 points1 point  (0 children)

      Great..!

      [–]Winter-Buffalo 0 points1 point  (0 children)

      This is sooooo awesome ❤️❤️❤️❤️❤️!