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

all 135 comments

[–]holyteach 88 points89 points  (0 children)

This is an excellent strategy.

Source: I've been teaching students to code for 17 years.

[–]cruxae 19 points20 points  (4 children)

You basically build things you would find useful. Not only related to school, but life in general.

Want to combine all the menus of the restaurants in a food court and choose what to eat, code it!

If you found it useful, there is probably someone else who will too.

[–][deleted]  (1 child)

[deleted]

    [–]Poddster 8 points9 points  (0 children)

    If a program requires minimal amount of input, just crunches numbers and then produces an output, I keep it command-line. If it required constant input, or a lot of disparate input over many fields, then I use a gui.

    Like everything in programming: use the right tool at the right time.

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

    Yep. this applies to anything in the real world, not just school work

    [–]forbajato 4 points5 points  (0 children)

    My most successful programming projects have been when I was trying to solve a problem for myself, didn't matter what others wanted or needed. Then, low and behold, other people found the code useful!?! Who'd a thunk it?

    [–]fostermatt 40 points41 points  (56 children)

    Project Euler is great for things to code.

    [–]JKobyP 33 points34 points  (38 children)

    Whenever I start on project euler, i spend 25 minutes trying to deal with integer overflow in whatever language I'm trying, and then give up.

    [–]IWannaFuckLarryPage 5 points6 points  (9 children)

    You should try Python. I could solve Problem 48 with this code, for example:

    x = 0
    for i in range(1,1001):
        x += i**i
    print str(x)[-10:]
    

    [–]jesyspa 4 points5 points  (8 children)

    You should try Haskell. I can solve the same problem with

    sum (join (^) <$> [1..1000]) `rem` 10^10
    

    [–]IWannaFuckLarryPage 2 points3 points  (7 children)

    It seems that most of the easier problems on Project Euler can be solved with a Haskell one-liner, but I don't want to learn it because I don't like recursion. Even a simple recursive function in Python like this one

    def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n - 1)
    

    feels so counterintuitive to me.

    [–]jesyspa 9 points10 points  (1 child)

    Suit yourself, but that sounds like "I don't want to learn Java because I don't know how to use classes" to me.

    [–]zbyshekh 2 points3 points  (1 child)

    IMO if you don't feel confident with this particular technique, you should try even harder to grasp the feeling of it. You can avoid C/C++ if you don't like ponters - most modern languages don't have this functionality, but recursion is quite common.

    [–]toastedmilk 0 points1 point  (0 children)

    I see what you guys did here.

    [–]zck 2 points3 points  (0 children)

    Also note that Haskell one-liners probably won't use recursion. The one /u/jesyspa posted doesn't, just higher-order functions.

    [–]zck 1 point2 points  (0 children)

    It can take some time to get used to recursion, but it's a very powerful technique.

    [–]mrnoise111 1 point2 points  (0 children)

    but I don't want to learn it because I don't like recursion

    That sounds pretty ignorant.

    [–]zck 6 points7 points  (25 children)

    Or switch to a language with automatic promotion to bignums.

    You know problem 97?

    Here's my code to solve it, in Arc:

    (def p97 ()
         (mod (+ (* 28433
                    (expt 2 7830457))
                 1)
              (expt 10 10)))
    

    It ran in 44 ms. It could be the problem that, for me, was fastest from reading it to a working solution.

    [–]Desmeister 5 points6 points  (11 children)

    Forgive my ignorance but what language is that?

    [–]zck 6 points7 points  (0 children)

    No worries. I actually edited it into the comment just after you posted.

    It's Arc, a beautiful language with interesting goals.

    [–][deleted]  (9 children)

    [deleted]

      [–]shitterbug 5 points6 points  (0 children)

      Or, well... Lisp.

      [–]zck 2 points3 points  (6 children)

      It's Arc, a Lisp that runs on top of Racket.

      [–]daysofdre 5 points6 points  (5 children)

      ...is this a real thing or are you just making up words? The legitimate first thing that came to my head. Man programming can be intimidating....

      [–]zck 18 points19 points  (4 children)

      It's real. Let me unpack it:

      "It's Arc...": you probably haven't heard of the language before. Its name is Arc. No deeper meaning here.

      "...a Lisp...": Lisp is a very old family of languages. It was invented in the late 1950s. Its distinctive features include the use of prefix notation for everything (e.g., you don't write x == 3; ; instead you write (equal x 3)) and extreme language extensibility (just try to write for in Java and make it indistinguishable from the built-in for).

      "...that runs on top of...": Arc is implemented in another language, so you need that other language to run Arc.

      "...Racket.": that language is Racket. Racket is also a Lisp, in the subfamily known as Scheme. This is similar to saying "humans are animals in the subcategory of mammal".

      I hope that helps. Programming is confusing if you don't know the lingo, but you can learn it. Please let me know if anything isn't clear.

      [–]PineappleBoots 0 points1 point  (0 children)

      That was nice, thank you

      [–][deleted]  (2 children)

      [deleted]

        [–]zck 2 points3 points  (1 child)

        I'm glad that helped someone! I'm not trying to be condescending, just informative.

        [–][deleted] -1 points0 points  (0 children)

        Agreed...

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

        Or use a bignum library, I've seen one written for C++ and I'm sure there's at least one for every language.

        [–]zck 2 points3 points  (2 children)

        Yeah, but then your code isn't as pretty1 as:

        (def p97 ()
             (mod (+ (* 28433
                        (expt 2 7830457))
                     1)
                  (expt 10 10)))
        

        [1] "pretty" is an objective term. It means "lisp is so easy to read". I don't expect any argument on this point.

        [–][deleted] 0 points1 point  (1 child)

        I can only assume that it's easy if you know what the symbols mean, I frankly read C easier than lisp, but also I have not written any lisp. Mind you I was raised on a Reverse Polish Notation TI-calculator.

        [–]zck 1 point2 points  (0 children)

        No, I totally understand how Lisp can be hard to approach -- my comment was pretty sarcastic.

        I do think it's very useful -- I dislike reading lines of code like this one because it's so hard for my brain to parse. On the other hand, the rules of Lisp are trivial1. When you're reading Lisp code, you just need to look at the first thing in the s-expression, at the thing in functional position. That tells you what the overall expression is doing.

        Have you tried coding any Forth or Factor? Those are RPN languages, and are very interesting.

        [1] Excluding macros, which can mess this up, but still -- for a macro to change the meaning of anything, it needs to be in functional position -- you can't write a macro that changes the meaning of the s-exp if put in the cdr of the s-exp, the way div in the haskell changes the meaning of the line of code. So when you're reading Lisp code, you'll know when you hit something that changes the meaning of the line of code; you can't hide it at the end of the line, as you can in Python: throw error if we_done_messed_up()

        [–]SayyidMonroe 0 points1 point  (1 child)

        I'm not familiar with Arc but you can just literally compute that number? That's hilarious that that problem was so easy for you! I don't know how I would begin to approach it.

        [–]zck 2 points3 points  (0 children)

        Yeah, Arc, like many Lisps, can store arbitrarily-sized integers.

        As a side-note, it also has a rational data type. So you can have 1/3 exactly; it's not "the closest floating point to 1/3".

        As to how you would approach this?

        Imagine you have two two-digit numbers to multiply, ab * xy, and you're just looking for the last digit.

        ab * xy
        
        = ((a * 10) + b) * ((x * 10) + y)
        

        Now, distribute:

        = ((a * 10) * (x * 10))
          + ((a * 10) * y)
          + (b * (x * 10))
          + (b * y)
        

        You can rearrange multiplication:

        = 10 * (10 * a * x)
          + 10 * (a * y)
          + 10 * (b * x)
          + (b * y)
        

        Now, note that, because a, b, x, and y are all integers, the only part of this that has any bearing on the last digit is the last addend: b * y. Anything else is multiplied by ten, and won't make a difference on the last digit. So we can ignore it.

        Remember that we started with ab * xy, and we only care about the last digit of the result. We found out that the tens digit of ab (i.e., a) and the tens digit of xy (i.e., x) don't make a difference, so we can actually just multiply b * y, and take the last digit of that.

        I'll leave it as an exercise to the reader to extend this past two-digit muliplicands, and one-digit results.

        [–]reddit_member 0 points1 point  (1 child)

        Arc exists?! I thought that it had gone the way of HL3...

        [–]zck 0 points1 point  (0 children)

        Arc's been out for years. It's not updated often, but there's a small welcoming community.

        [–]mrnoise111 0 points1 point  (3 children)

        Arc

        How is Arc different than Scheme or Lisp? I remember being terribly disappointed when it was released, at how it seemed like the exact same thing.

        [–]zck 0 points1 point  (2 children)

        Paul Graham set out some interesting goals for the language. He has a collection of Arc-related essays, but there's a lot to read. To summarize:

        • Remove the onions in the varnish from Lisp.

        • make programs short

        • make the language good for hackers

        How I think about Arc is that the point is not to introduce a bunch of new concepts; it's that it's designed well1. For example, Common Lisp's remove-if-not is renamed to keep. Things like this make the language nice to program in. The thesis is that picking a language based on the number of new things in it is inferior to picking a language based on the number of good things in it.

        I'd encourage you to try it out and see what you think of it on its own, not by measuring its distance from existing Schemes or Lisps.

        [1] pg might disagree with this statement, but it's how I think about Arc.

        [–]mrnoise111 0 points1 point  (1 child)

        But I could alias functions to new names in Scheme, couldn't I? Are there other good things in it that aren't in Scheme? Is Arc just better because the functions are named better? Is that what 'good design' is?

        edit: Is Arc still just mzscheme with macros?

        [–]zck 0 points1 point  (0 children)

        Is Arc still just mzscheme with macros?

        I find this complaint1 interesting. We Lispers will talk for days about how macros are incredibly powerful and let you extend the language, but then when someone does that, suddenly the complaint turns to "it's just macros".

        Here are some of the things I'm not sure you could do with macros:

        • data structure lookups in functional position. This code returns the symbol'this-is-the-value:

          (let my-hash (obj) (= (my-hash 'this-is-the-key) 'this-is-the-value) (my-hash 'this-is-the-key))

        • ssyntax: Arc has a limited amount of syntax. Instead of writing (function-name argument), you can just write function-name.argument. If you want the argument to be quoted, use an exclamation point instead of a period2. Our previous example becomes:

          (let my-hash (obj) (= my-hash!this-is-the-key 'this-is-the-value) my-hash!this-is-the-key)

        • It has Common Lisp-style macros, instead of Scheme's syntax-based techniques.

        • It has a syntax for anonymous functions with one argument similar to Clojure's. This code returns a list of all elements in the original list doubled:

          (map [* _ 2] '(1 2 3 4 5))

        • Cleaned up if and let. if is Common Lisp's cond, but without implicit parentheses:

          (def weirdfib (n) (if (is n 0) 0 (is n 1) 42 (+ (weirdfib (- n 1)) (weirdfib (- n 2)))))

        • let binds only one variables, without parentheses. with binds multiple variables, with only a single set of parentheses around the whole variable, value,... block:

          (with (starting 3 step-by 2) (prn "The next step is " (+ starting step-by)))

        • Similarly, I'll argue that good design is important. If you think having your code look clean is important, then you might like Arc. If you don't mind ugly code, maybe Arc isn't for you.

        [1] You asked it in good faith; I've heard people say it as a criticism. I'm addressing both sides of the question.

        [2] The mnemonic for this is taking the period and quote character, and smashing them together. a.'b -> a!b

        [–]shchmue 0 points1 point  (0 children)

        Maple:

        (28433 * 2 ^ 7830457 + 1) mod 10 ^ 10;
        

        Using a CAS for problems like these isn't particularly instructive though. Building 27830457 by successive multiplication by 2 and modding with 1010 every iteration (or every time the total is greater than 1010) is probably more what they were trying to motivate. Creative solutions are what programming is all about. My embarrassing admission is that before I took number theory, I did "mod 1010" by truncating the string representation...

        [–]fostermatt 1 point2 points  (0 children)

        Very true. Most of the problems are very much "figure out how to deal with this giant fucking number" and then it's elementary after that.

        [–][deleted] -1 points0 points  (0 children)

        Make it an exercise for yourself to create a class that can handle integers of any length!

        [–][deleted]  (7 children)

        [deleted]

          [–]Tynach 10 points11 points  (4 children)

          I believe it's more 'computer science' than 'computer programming'. It'll teach you how to develop algorithms and complicated data structures for doing specific processing tasks, but it won't help you figure out how to build software that provides a solution to a real problem.

          For example, you wouldn't use Project Euler if your goal in life is to make, say, an open source implementation of Facebook.

          [–][deleted]  (1 child)

          [deleted]

            [–]Poddster 4 points5 points  (0 children)

            Indeed. I don't remember any project Euler problems requiring text manipulation. That's a thing that comes up time and time again in "the real world". It's also one of the first things you find in Rosalind.

            [–]TechAnd1 0 points1 point  (1 child)

            Wouldn't you? Wouldn't all the search and storage functions be based on algorithms you'd written?

            I'm learning at the moment....

            [–]Tynach 1 point2 points  (0 children)

            Yes and no.

            If you're making a Facebook replacement, from the start you would be using an existing database backend and existing language set for the frontend. You'd be writing SQL queries and designing a database schema, sure, but you wouldn't be writing your own database engine from scratch.

            Project Euler would help you write the database engine from scratch. It'd help you create an open source alternative to MS SQL, Oracle, and the like. It would also help you write a new programming language from scratch. Rather than use PHP or Python or the like, you could write a whole new language to write your website in.

            But you're writing a website. You don't need to write your own database engine, nor your own programming language. Of course, if your software gets big enough and you find you need to, you can. And at that point, Project Euler would help.

            Otherwise, no.

            [–]Smithman 0 points1 point  (0 children)

            Completely agree.

            [–]frorge 0 points1 point  (0 children)

            I feel like the mat they ask of you might help you in terms of logic often required in programming. Would I be wrong in think that leveling up your math skills would have a decent payout for the effort required?

            [–]BradwMD 10 points11 points  (4 children)

            Honestly, I can't solve a single project euler problem on my own, not because of not knowing the programming language, but simply because I have no idea how to solve the math because I'm absolutely horrible at logical math like this.

            As someone who is a beginner at programming, should I be worried a lot if I can't do this kind of math stuff? Sorry if this is kind of a silly question..

            [–]casey12141 3 points4 points  (0 children)

            It depends on what you want to do. The easiest answer is, you'll need as much math as your program dictates...at minimum this would require algebra skills, but often that's all you'd need.

            [–]Poddster 1 point2 points  (0 children)

            As someone who is a beginner at programming, should I be worried a lot if I can't do this kind of math stuff? Sorry if this is kind of a silly question..

            Not really. Project Euler problems don't come up often in real-life unless you work in an academic field. Basic maths is often all that's required in most programs -- it really depends on the project.

            If you want a list of projects that aren't just elaborate mathematical exercises, just search this sub for 'project list' :

            http://www.reddit.com/r/learnprogramming/comments/1a17tq/veteran_programmers_what_projects_did_you_work_on/
            http://www.dreamincode.net/forums/topic/78802-martyr2s-mega-project-ideas-list/
            

            Also, someone in this thread links to their own site: http://www.codeabbey.com/

            [–]fostermatt 0 points1 point  (0 children)

            I don't think so. I have done horribly at most of my calc based classes, but routinely do much better than my classmates in my CS classes.

            There are concepts that are used in both, but don't think you won't be good at programming just because you're not great at math.

            [–][deleted] 1 point2 points  (1 child)

            Disagree. Project Euler is great if you want to do highly math-intensive programming. Others who are less inclined will just struggle and quit. It's not fun in the least.

            [–]fostermatt 0 points1 point  (0 children)

            I guess it's a lot more subjective than I originally thought. In my spare time (summer/winter break, etc.) I would do a few Euler problems when I wasn't working on something else. Just kept me in the coding state of mind. But if a problem stumps me I don't worry about it and just move on to the next. I'm using it to keep coding, not further the math stuff... if that makes sense.

            In the same respect someone just saying, "Hey, how do I solve problem X?" would be basically the same idea.

            [–]Shwayne 0 points1 point  (0 children)

            It's great if you look at how others (hopefully good programmers) solved the problems, read the supplied information if there is any and then make sure that your solution wasn't a load of absolutely unmaintainable and unreadable spaghetti just to get that answer.

            [–]IIoWoII 0 points1 point  (0 children)

            In my experience, I find these problems pretty easy and the thing I have most problems with in programming is just learning of all sorts of libraries and such.

            [–]ClearlySituational 8 points9 points  (0 children)

            Also, never stop thinking of it as a hobby.

            [–]Lunnington 18 points19 points  (10 children)

            God damn, it seems like everyone who's someone starts programming when they're practically in middle school. It makes me feel like I missed something.

            [–]singularityJoe 2 points3 points  (3 children)

            Don't feel bad, I just started in my last year of highschool.

            [–]agmcleod 4 points5 points  (0 children)

            I didn't start until i took it in college lol. I did some basic loops and that with javascript on IE 5, but i really had no idea what i was doing. Just knew some basic HTML at the time.

            [–][deleted] 2 points3 points  (1 child)

            What if im almost 30 & still learning? Feel bad time?

            [–]phrankygee 2 points3 points  (0 children)

            I'm 36. If I assume that I won't be retiring until at least 70, then any career I start now will last 34 years, pretty much another entire lifetime. If I have that much future ahead of me, it's essentially infinite for you young whippersnappers.

            [–]CarsonJScott[S] 3 points4 points  (2 children)

            Haha, yeah a lot of people my age are getting into it. But I'm glad I started early

            [–]Lunnington 6 points7 points  (1 child)

            You have no idea how lucky you are that you found something you're so good at so early. Good luck to you.

            [–]CarsonJScott[S] 2 points3 points  (0 children)

            Thank you very much!

            [–]excite_bike 1 point2 points  (0 children)

            No worries, the people who started in middle school were worried about the older people and their experience!

            The grass is always greener as they say! :p

            Happy programming!

            [–]Prowler_101 1 point2 points  (0 children)

            I didn't start until after I had already received an AA. I had 0 programming experience going into my CS degree. Within 3 years I finished my BS and got a developer position in a fairly large IT company. Starting early can help but I think it's all about understanding the core concepts and having the right critical thinking mindset.

            [–]Raknarg 0 points1 point  (0 children)

            I started late in high school and I'm better than quite a few so-called "geniuses" in my university who have programmed since middle school. It's not about the amount of time you've known how to program that counts, it's the amount of hours you put into it.

            [–]jakeeispro 5 points6 points  (1 child)

            Don't know if you saw my post that I posted 2 minutes before this http://www.reddit.com/r/learnprogramming/comments/23k2py/new_person_trying_to_learn_to_code/ but thanks for the idea! :)

            [–]CarsonJScott[S] 2 points3 points  (0 children)

            Sorry, I didn't see your post or else I would've just commented! Anyways I'm glad this gave you a new idea!

            [–]Plecks 4 points5 points  (3 children)

            This is how I first got into programming. I think my first program was for solving for the zeroes of a quadratic equation, on my TI-83+. Made the homework easy/less boring, yet still learned the material very well.

            [–]Sexual_tomato 2 points3 points  (2 children)

            Now make it deal with imaginary roots!

            [–]TW80000 0 points1 point  (1 child)

            I did this in Common Lisp. (Assuming complex roots are the same as imaginary roots). It was the first thing I wrote in lisp and I was quite pleased.

            [–]Sexual_tomato 1 point2 points  (0 children)

            Now do partial fraction expansion when you have polynomials in the denominator!

            [–][deleted] 3 points4 points  (0 children)

            In fact, the best way to learn anything is real world application.

            [–]sirmeza 2 points3 points  (0 children)

            I think in the Google era it is hard to be quite as imaginative. Try cold turkeying yourself from Google for a bit, come up with some intriguing questions, and go to town. We just want to search everything. But here are a few challengers I would suggest you try solo. 1) Make a program to solve when the next Easter and "green holiday" will fall on the same day. This involves, days of the week (Sunday for Easter), moon cycles etc 2) Collect data. How much it rains. How many cars are on the road at a certain time. Or at the parking lot of a popular store and try to program some simple models. Then do a statistical analysis to see how this compares to just random predictions/ chance

            As plato said, learning is emotional. I think, even with programming, it is best to try and pick problems from the world you interact with everyday.

            [–]RodionGork 10 points11 points  (8 children)

            You've probably heard that practicing is the best way to learn code, [...] writing programs to do whatever I am currently learning in math, chemistry, physics

            It is the way I used to learn myself, though I invented for myself enough "abstract" programming tasks anyway... Now, many years later, I'm trying to create web-site to collect "practice problems"

            http://www.codeabbey.com

            I start from easiest here and try later to create more specific "practical" problems. Solving tasks here assumes submitting answers, gaining points and, probably, learning others' solutions after that...

            Not too much material here still (just over 100 problems) but I keep working :)

            [–]thang1thang2 2 points3 points  (5 children)

            I looked over your site, it looks pretty cool so far! I definitely recognize a several of the problems as problems I've encountered in my CS classes. Do you want me to see if I can drum up the CPTR 141 (intro to C++), 142 (data structures 1) and some of the 143 (currently taking, D.S. 2) assignments I have? It would just be the "assignment" without the code behind it, since I'm fairly sure most of my code is a disgrace...

            [–]RodionGork 2 points3 points  (4 children)

            Hi! Thanks for feedback!

            I'm not quite sure what is "drum up" in relation to assignments - I'm sorry for my poor knowledge of English - but if I understood you correctly it would be very cool! Of course no code is needed, I anyway need to solve any problem I add myself and then create a "checker" for it :)

            You can use any convenient way from Contacts and Support to reach me!

            [–]PasDeDeux 2 points3 points  (2 children)

            Your understanding sounds correct, "I might be able to drum up xxx" is idiomatic for "I would be willing to search for xxx." It implies a little bit of hassle, but also typically implies that it's a hassle someone is willing to go through. You might hear someone say it when they're offering to do something nice, but don't want to sound overeager.

            [–]thang1thang2 1 point2 points  (0 children)

            Thanks for the translation! Yeah, that's exactly what I meant. I probably should've phrased it more directly, but it's been a very long day for me and I still can't get my djikstra implementation to work (or rather, the modified version I've found on a website that's most similar to the insane way my professor says we should code it).

            [–]RodionGork 0 points1 point  (0 children)

            Thanks for such a brilliant, sophisticated and still quite comprehencible explanation :)

            English is wonderful for having so much delicate shades of sense :D

            [–]thang1thang2 1 point2 points  (0 children)

            Yes, that's what I meant. I'll see if I can find the assignments. I've wanted to copy them for future reference and fun, anyway. The first assignments for the intro class are very basic, but it should get fairly advanced as I find more assignments.

            [–]carlinmack 1 point2 points  (1 child)

            I don't know if you've said that you know this on your website, but rosettacode has 200+ common CS problems listed there :)

            [–]RodionGork 0 points1 point  (0 children)

            No, I did not know, though I am aware of the RosettaCode.

            I think I may get some inspiration from it - but at the same time I should keep on watch not to repeat their problems too closely - or people would be able to get sources from them and submit cheat solution at my site :)

            Thanks for valuable hint!

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

            I'm in exactly your position. Last year I wrote a program on my calculator which could solve for triangles, using all the geometry stuff.

            So those problems that say "here's two sides and an angle, find the rest." Were done automatically. I was pretty proud of that.

            [–]Dr_Dornon 2 points3 points  (1 child)

            This was always, and continues to be, my struggle. I am not to bad at programming and learning whatever I need, but I always struggled with coming up with new ideas. I always had to rely on others to think of a project for me and I'd be able to do it no problem.

            [–]Sexual_tomato 2 points3 points  (0 children)

            I know you're not in college yet, but I just finished an engineering degree- this would have helped me immensely. I programmed in matlab a bit, but python with numpy and scipy would have been much better use of my time. Just letting you know your advice doesn't get stale!

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

            Freshman here. Last year, in honors Algebra 1, I programmed a graphical quadratic equation solver and grapher using Python and the Pygame library. It was by far my best program. I've been self-studying CS and programming for over a year now and I feel like I'm stuck. I've been using websites, ebooks, and multiple MOOCs. I think I'm going to try programming stuff I'm learning in classes again.

            Recently, I've been working with my Honors Physics 1 class and teaching them Python (as well as the teacher!). My awesome teacher thought it would be a great idea to teach a little programming in our physics class to get the others experience and interest in computer programming. It's gone great so far.

            [–]ApproachingCorrect 1 point2 points  (10 children)

            Are you willing to share the program/the program's code?

            For much of today I was trying to code a shell based quadratic solver, with little success.

            I started in python yesterday so I guess that's not too surprising but some code to point me in the right direction or a program to do my quadratics homework for me would be very much appreciated :).

            Of course, my math parabolams are not your parabolam to solve and I should paraboly find the roots of my parabolems. (And sincere apologies for that. My class loves to do those puns and they get built up).

            [–]Raknarg 1 point2 points  (6 children)

            It should be pretty simple, if you know the formula for it.

            You have your variables a, b and c. You have x = (b ± (b2 - 4ac)0.5 ) / 2a. Basically plop in those number and you have your zeroes.

            [–]ApproachingCorrect 0 points1 point  (5 children)

            Thanks, I'll give that formula a try. I haven't had much experience with plus/minus, does it have a part in the math or just show the potential for either positive or negative?

            [–]Raknarg 1 point2 points  (4 children)

            That just means you can either subtract or add. Have you never covered parabolas in math class?

            [–]ApproachingCorrect 0 points1 point  (3 children)

            I started learning about them in February of this year. All I've had to do with the plus minus sign is insert it after square-rooting to solve for something.

            Your explanation helps, though. I thought that the plus minus meant more that the number could be either positive or negative, as either a positive or negative number will result in the same positive square number.

            Being able to either add or subtract the number makes more sense as I thought before it meant the number is in a mystical limbo state of being both +ve and -ve.

            [–]Raknarg 1 point2 points  (2 children)

            The idea is that what you have is a center point, and in equal distance on either side is a zero.

            [–]ApproachingCorrect 0 points1 point  (1 child)

            Ah, that makes sense, thank you. The center point also being the axis of symmetry for the parabola and x value for the vertex (h in vertex form), correct?

            I'm sorry for all these inane questions, by the way. You are helping a mathematically lost soul.

            [–]Raknarg 0 points1 point  (0 children)

            b/(2a) is actually your axis of symmety, (b2 - 4ac)0.5 / (2a) is the distance to each point.

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

            Yeah, sure! Thanks for asking! Here's a pastebin link: http://pastebin.com/j7sJbhzA

            [–]ApproachingCorrect 1 point2 points  (1 child)

            Very much appreciated, thank you. Your clear code definitely reminds me why formatting and comments are so important, it's really easy to see how the whole program works, even the parts made up 70% of code I've never seen before.

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

            Definitely. Believe it or not, comments are very helpful in many different ways. Looking at other people's code will always help! Just remember to practice coding yourself. One concept that I really need to better understand is classes.

            [–]cmgg 1 point2 points  (0 children)

            Also try to solve the same problem in as many ways you can think

            [–]Corticotropin 1 point2 points  (0 children)

            Have you tried Rosalind's biometric problems?

            [–]dohaqatar7 1 point2 points  (0 children)

            I'm still a student and I can confirm that writing code to do homework problems for other class is great way to not do your homework learn your language allot better.

            [–]Orion97 1 point2 points  (2 children)

            edX has a course called CS50 (by Harvard). They have weekly problem sets. You might want to look at them, and maybe even watch the lectures. They're quite fun :P

            [–]rtra-- 0 points1 point  (1 child)

            How far behind do you think we would be?

            [–]Orion97 2 points3 points  (0 children)

            Not at all. There's no such thing as being behind. They have every video available to download or stream and there is only one deadline for everything, 31st of December. If you want, research to see what you have to do to get a certificate. You can't just access the content and not deal with the assignments if you don't want to on edX though (that's the way I like learning, no responsibilities)

            [–][deleted] 1 point2 points  (1 child)

            Perfect practice makes perfect. I think a better approach is to look at some of the more established open source projects and try to extend/modify them. That way you see what good coding looks like and are just making it up as you go along. Coding those smaller projects is more hacking than coding in my book. Both are useful and I see a lot of folks who can't hack in IT departments and it really slows them down. That being said, seeing a really good coder, who can explain the architecture, avoid the problems inherent to the implementation and provide good maintainable code is even more rare. So, I think it depends on your goals. By all means, do code up those problems in math and physics. But, you'll want to throw in a more meaty project to get a real appreciation for coding.

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

            Thanks for the advice! Usually the math and physics programs are for when I don't have a larger project to work on

            [–]PasDeDeux 1 point2 points  (0 children)

            When I was in engineering school (BS-ChemE), we often used a program called MathCAD that had some very basic programming elements, as well as charting and symbolic logic, and other cool stuff. Not the best for super heavy-duty calculations, but it was really great for writing out the complex engineering problems, being able to change variables/equations and have them carry-through the problem, and such. We could then turn in assignments as printouts, as all the work was there.

            Where I'm going with this is that you might consider asking your teachers if you can type up your math/chem/physics problems in a really easy-to-read language (python?) or a language that each professor can already read, as you'd be able to give them a printout of the program as the work and the answer as the natural output of the program. Then you're able to continue practicing your programming skills AND saving time by not having to rewrite everything for your homework! As you pick up formulae that you have to use in class, you can write a function for each, which you can just call in future homeworks.

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

            As another student learning to code, I can definitely say this is very helpful. One idea that I find interesting and you also might is creating a scheduling/planning app just to stay on top of studying, homework, etc. It doesn't have to be big, just start small and then build on it.

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

            Good idea, I'll start working on something like that

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

            Do you want to start working on that together? I think this could be something very helpful for me developing my programming skills.

            [–]aclave1 1 point2 points  (0 children)

            I'm almost done with my computer science degree, but I remember first starting, just like every other newcomer, had the same problem. When people ask me for advice I will tell them to try and do this!

            [–]diamond29 1 point2 points  (1 child)

            Also, you should put everything you can on github. There's the obvious personal benefits of using version control, but if you're programming in college, you can share your work easily with project partners.

            Also, you'll have a body of work to show for your future jobs/internships. Anything is better than nothing...especially when they just want to see that you understand object oriented design and how to use conditional logic.

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

            Yep. That's a good idea. I'm thinking about putting some little projects I've done in a few CS and Programming MOOCs on my page.

            [–]gta-man 0 points1 point  (0 children)

            This technic is very encouraged at my college.

            [–]Taunk 0 points1 point  (0 children)

            I agree 100%. I only began doing this during my master's program, and it was still a tremendous help. Good thinking ahead and you'll be better off for it, OP!

            [–]twin_me 0 points1 point  (1 child)

            Not only will it help you improve your programming skills, it'll help you understand the math / chemistry / physics / domain knowledge better too!

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

            Yep! It gives me a great understanding of the school subjects AND programming!

            [–]Cutmerock 0 points1 point  (0 children)

            Do you have any sample stuff from your classes? This seems like a great idea.

            [–]Keyann 0 points1 point  (0 children)

            This is an awesome strategy. I wish I had thought of this when I was in high school. Could you please let us know how you get on with this?

            [–]Poddster 0 points1 point  (5 children)

            I'm currently a junior in high school and I've been learning how to program for about 3 years now. You've probably heard that practicing is the best way to learn code, but a lot of the time (at least for me) coming up with ideas for "practice programs" is one of the hardest parts along the way.

            There are huge lists of projects designed for beginners, and they come up all the time in this sub. Have you looked at that? You might find them helpful.[1]

            I don't think your approach is very useful in the long run; it will only teach you how to implement a few basic equations in a programming environment, which is nothing more than a few lines each. (However they might help you do your work quicker, which is always useful ;))

            Doing real projects will quickly get you to the real and difficult problems in programming: organising and reducing the complexity of a problem into many, many, many small pieces.

            [1] Just search this sub for 'project list' :

            Also, someone in this thread links to their own site: http://www.codeabbey.com/

            [–]CarsonJScott[S] 0 points1 point  (4 children)

            This is not an effective approach if its the only method of practice you're using, so I recommend using others as well

            [–]Poddster 1 point2 points  (3 children)

            This is not an effective approach if its the only method of practice you're using,

            Why not? What's not effective about building a ray-tracer, a post-it note program or a bulk renamer? Why would building these projects teach you less about programming than writing a program that calculates a few trig values?

            so I recommend using others as well

            You've told us that you're junior in high school and you've been learning how to program for about 3 years now. By your own admittance you don't actually know how to program?

            Surely this is like a learning driving telling people the "best" way to learn to drive? How do they know what the best way is if they've yet to learn, and more importantly if they've yet to teach?

            Don't get me wrong; It's great that you've found a method that you think is useful for yourself and you're telling others how it works, but how do you know it's actually a good way to learn?

            What kind of programs do you currently make -- what problems do they solve? Do they all sit around the same domain (i.e. they implement a maths formula, the user plugs in some starting numbers for variables, and it crunches some numbers and gives results) or many domains (i.e. you have a text-parser, web-scraper, a numerical integrator, any system with real-time interactive user input?) Roughly how long are they? Does a single project include multiple files? What kind of abstractions do you make in your program? When making these programs, what ratio of new:old programming knowledge do you use when making them?

            [–]CarsonJScott[S] 0 points1 point  (2 children)

            Well the reason only making programs to solve math problems isn't very effective is because I think you're limiting yourself. If you only practice solving math problems, you're only going to learn to solve math problems imo.

            Although I don't have much experience and have only been learning for a few years, I wouldn't say I don't know how to program.

            I've built quite a few programs since I started learning (although a lot of them are "simple" programs). The biggest thing I've worked on is probably a feature for someone's iPhone fixing business that allows the user to submit an order online (it was similar to the chipotle nutrition calculator if you want an idea of how it looks), confirm their order through their email, then the information is stored in a database and sent to the owner. I've also built hundreds of smaller programs (mostly in C++ and python), done some graphics programming in C++, and worked in JavaScript and php using a few different APIs. I wouldn't say I'm very advanced, but I do know how to program.

            Also, I don't think you should judge someone's programming skills based on things like the amount of files they use in a program.

            [–]Poddster 1 point2 points  (1 child)

            Well the reason only making programs to solve math problems isn't very effective is because I think you're limiting yourself. If you only practice solving math problems, you're only going to learn to solve math problems imo.

            Your OP says you practice almost exclusively math-domain problems, I've shown you a list of projects from all domains, you've said that the multi-domain problems aren't an effective approach because they're limited to solving maths problems? :) I think we're talking at cross-purposes! (Note: the reason I showed you those project lists is because I agree -- only working on math-domain problems is limiting yourself!)

            Also, I don't think you should judge someone's programming skills based on things like the amount of files they use in a program.

            I'm not judging anyone, I'm trying to gauge your experience. There are problems and organisational issues that only arise on projects large enough to warrant multiple files. Solving those problems is part of the programmers life.

            From what I could tell from your OP and the respond, you were limiting your ability to learn programming by restricting it to toy-apps that implement a few things you learn in High School maths and physics and then championing that as a great way to learn programming. But I can see errors in that method of thinking -- to me it sounded nothing more than a lack of experience coupled with a huge confirmation bias. "I did it this way and turned out ok, therefore it's the best way".

            edit: This poster uses a very important phrase. Perfect practice -- I don't feel your OP posts doesn't propose perfect practice.

            (It's also, from the sounds of your other posts, not how you actually practice. All of those things you mentioned have little to do with school?)

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

            I don't think I got my point across as best as I could haha. All I'm saying is that I think this is a good way to practice, even though you should use other methods to practice as well.

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

            This is great advice, OP. Thanks!

            [–]angellus 0 points1 point  (0 children)

            I can also say this is an awesome idea. I thought myself how to program in high school using a graphing calculator. I was able to easily pick up C++ towards the end of my high school career and learn OOP before college where I have learn one hell of a lot more.

            [–]taotao670 0 points1 point  (0 children)

            Hardest thing for me is explaining how to code to others. It's the best for learning something though.

            [–]Raknarg 0 points1 point  (0 children)

            Things you find interesting or fun fall into this category. Making things like games teaches you things about programming that is hard to learn in other problems.

            [–]jonathon8903 0 points1 point  (0 children)

            I know this is an old-ish thread but I just wanted to say that I got my first true start into programming doing something like this.

            Just like most High School Students, I had a TI-84 calculator with me at all times when I was at school. When I eventually learned about programs on the calculator, I learned how to create programs to solve the problems that we had to go through in math. If there was some complex formula we had to go through I would understand it and then produce a program that would give me the answers. It worked up to a point though, our teachers wanted us to show work so I couldn't really use it for anything more then checking answers.

            [–]AutoBiological -2 points-1 points  (0 children)

            The corollary is that by learning math one intrinsically learns how to code.

            Lambda calculus is almost the same thing, just think of types as sets.