10 Days of Basic Programming, Day 6: Input/Output, recursion and some exercises

Acid_Snake

I like beer.

13 Responses

  1. solid_gabe136 says:

    The way i first understood recrsive fxn is to look at a function that is recursive itself, for instance n! Can be easilily written with recursion, so technically calculatng e might require an n! Fxn or importing some math library

  2. NoSpam says:

    10 print “Wo”
    20 print “lo”
    30 goto 20
    RUN

  3. k3nn says:

    –the above function that counts from 0 to 10 has a mayor flaw in it, can you tell what it is?

    if you call recursive using a number > 10 as the first value, it will turn into an infinite loop.

    • k3nn says:

      recursiveCount(11); <– infinite loop

      • Acid_Snake says:

        that is indeed correct.

        • k3nn says:

          woohoo… f.i.r.s.t.! but i still haven’t figured out how to do the Big Oh(log n)…the only thing i know that could do that fast is 2^n using shifts instead of actual multiplication.hmmm…

          • Acid_Snake says:

            Yeah but I’m not talking about powers of 2, I’m talking about any power. You have to make an algorithm pow(b, n) that calculates b^n in logarithmic time. Replacing multiplication with shifts doesn’t exactly change the complexity and cost of the algorithm.

  4. nebu_187 says:

    i just realised, u have to be a total geek to be a good programmer, no offense but whitout being totally obsessed with programming and having to much free time it is something u will never achieve to do well. if it is your proffesion its totally different of course. Ur 10 days of programming made me realise: ill just stick 2 gaming

    • Yatto says:

      No you don’t have to ! Here, Snake is teaching the basic of “how you have to think to program” (with some drops of C language here and there), but you can use these basic programming skills to program something with a WYSIWYG interface, where you draw a window, drop some buttons, then add some light lines of code, just as you would do in VIsual Basic for Applications, when you create a macro for MS Excel.
      In France, since 2014, children are taught basic programming skills (on their graph calculator mostly) from their 2nd or 3rd year of secondary school (when they’re 13 years old) and most of them love it because it allows them to make little programs to help them during maths tests ; and if they do these kind of programs, they are allowed, the teacher adapts the tests to focus on understanding. It works.

      So if you’re reading this, please consider trying to program on something light if you want to do some basic stuff. A graphic calculator (TI-83+ / Casio 25+ for example) is great for a beginner. But you can start with C or Python on PC as well, feel free to experiment.

  1. April 10, 2015

    […] <<< Previous: 10 Days of Basic Programming, Day 4: functions and scope >>> Next: 10 Days of Basic Programming, Day 6: Input/Output, recursion and some exercises […]

  2. April 14, 2015

    […] 10 Days of Basic Programming, Day 6: Input/Output, recursion, and some exercises […]

  3. May 1, 2015

    […] <<< Previous: 10 Days of Basic Programming, Day 6: Input/Output, recursion and some exercises […]

  4. May 18, 2015

    […] 10 Days of Basic Programming, Day 6: Input/Output, recursion and some exercises […]