Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

TuringTest Group Title

Python lessons for absolute beginners? I was using the MIT thing http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-189-a-gentle-introduction-to-programming-using-python-january-iap-2008/lecture-notes/exam1_soln.pdf but since I had never even done the "hello world" thing before it's a bit fast-paced for me. I'm also reading Sthurlow.com's tutorial, which seems too slow. Any good suggestions?

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I feel so stupid, I still don't quite grasp example problem 10 on the MIT link the "return a" part confuses me (I'm sure this is painfully remedial, but I've been going caveman style for quite a while now)

    • 2 years ago
  2. arcticf0x Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Try this http://www.udacity.com/overview/Course/cs101/CourseRev/apr2012

    • 2 years ago
  3. FoolForMath Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    If you ask me, Python as the first computer language is not advisable.

    • 2 years ago
  4. FoolForMath Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    Coming back to problem 10, f(a) is function which is returning a value.

    • 2 years ago
  5. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @FoolForMath and where would you advise me to start? btw I can figure out the math ideas like that (I think you know that I am already familiar with the concept of a function), but I am not sure why the program terminates at 5 is it that the output of b=0 is put in as a, and then then function does its job adding a 5, and that signals the end of the program? why? if f(a) acts as a+5 and "returns" a, that sounds to me like a recursive function that should go on forever, producing an AP with common dif 5 I don't really see how b comes into play... @arcticf0x thanks, I'm watching it but it is also a little slow-going.

    • 2 years ago
  6. FoolForMath Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    @TuringTest: I would suggest learning C first. Back to the question: def f(a): a = a + 5 return a Here, f(a) is a function and a is the parameter. When we do: b=0 f(b) it means that we are calling function f as f(0) ; But note this is call by value so only only a copy of the variable is passed to the function and (not the address) so even afterwards when we are trying to access the value of b it is still 0; Now, if we do: b=f(b) Here, we are are again passing f(b) i.e f(0) to the function but in this case we are saving the return value. Thus b becomes 5; so afterwards whenever you are trying to access the value of b it will be 5. So if (again) you do: b=f(b) now b will be 10 (We are now passing f(b) i.e f(5)) Now recursive function is a function where the function call itself. For example: f(a): a = a+5; return f(a) this is a infinite recursion.

    • 2 years ago
  7. arcticf0x Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @TuringTest If you want it fast and would like to keep it simple, this http://www.codecademy.com/ is the best option. Plus, don't confuse yourself following more than one of these sites (sources, languages) at the same time, settle down with any language you like and the learning material, follow it fully.

    • 2 years ago
  8. sasogeek Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @TuringTest start here :) http://openbookproject.net/thinkcs/python/english2e/

    • 2 years ago
  9. sasogeek Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @FoolForMath C as the first language????? you've got to be kidding me!

    • 2 years ago
  10. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    I'm curious, why do you think C makes a good first language and Python doesn't? This goes against all conventional wisdom.

    • 2 years ago
  11. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    A good example why one shouldn't learn (and especially teach) C as a first language is all those people who come here with C (or C++!) questions, who have obviously not grasped the very basics of programming. If Python seems difficult, C will be an order of magnitude more difficult. I strongly second the Udacity course. My 12-year old son has just finished unit 1 (which consists of 40 parts); it is more interactive than the ocw course, with very frequent quizzes, and _especially_ the opportunity to type in code right there in the browser.

    • 2 years ago
  12. FoolForMath Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    Apart from GW-BASIC and LOGO which I learned (and forgot) during grade schools, C is my first language! I find it interesting and enriching. But most of coding I (used to) do are algorithmic and as a part of programming contest training. Python is not yet accepted as official contest language so I wasn't much interested at that time. I learned python last year. Its beauty is in short and simple manipulations, it's a very good language when you are trying implement number theory algorithm. It has inbuilt bignum so you won't have to worry about integer overflows. Python offers a variety of math functions much more than C,C++ or Java. It also has inbuilt Lambda Calculus utility which is one of my favorite. To be honest, I don't know how could anybody think that C is harder than python?! In my opinion after say 6 months of C training one can easily understand almost any program written in C (using standard libraries) where as python has much more depths and variations. If anybody is interested, I started learning python form this book http://www.diveintopython.net/. It's free and of reasonable size, but that book might be somewhat difficult to comprehend for a beginner, so I would like to suggest http://www.swaroopch.org/notes/Python. This is undoubtedly the best book I have encountered so far.

    • 2 years ago
  13. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    How long have you been programming in C and in Python, and what other languages do you know? What's the biggest program you've written?

    • 2 years ago
  14. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    BTW, a good indication of the kinds of problems have that people who are learning how to program can be found right here in OpenStudy. There are many who are using C or even C++, and you can see the results. If someone who has learned C has trouble learning Python, that may also be because by learning C he has learned many specifics of the language, but is missing some general concepts of how to program. The best approach if you _really_ want to learn to think like an expert programmer is the SICP book (supplemented by its ocw course). There is a huge difference between "understanding almost any program written in C" (a claim with which I beg to differ) and _writing_ non-trivial C programs successfully and efficiently. I wouldn't know where to start with the complexity of C that will baffle a beginner, but string manipulation, collection data types and pointers are examples that immediately spring to mind.

    • 2 years ago
  15. sasogeek Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    "a good indication of the kinds of problems have that people who are learning how to program can be found right here in OpenStudy" I'm not exactly sure I understand what that means... i know it's probably the wording of the statement but if you could please explain cos i'm not making anything out of it :s

    • 2 years ago
  16. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    By that I mean that there seem to be a large percentage of people asking questions who are taking C or C++ courses who haven't grasped the most fundamental ideas, because they are fighting with the language more than with the methods of turning an idea (or set of requirements) into code.

    • 2 years ago
  17. sasogeek Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    true* Personally, C or C++ should be considered even maybe a 3rd or 4th language to learn. 1st language is out of the question. that's like a total disaster if one really wants to understand the concepts of programming.

    • 2 years ago
  18. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    And while it is not a good reason by itself, the suitability of Python as a first language is increasingly demonstrated by the adoption of it in entry-level courses at universities around the world (a change from other languages such as Scheme, which is possibly even more useful as a teaching language, but usually isn't used much outside of teaching; C never really was in the picture in that role)

    • 2 years ago
  19. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @FoolForMath thank you for the explanation of the procedure if the specific function, I think I understand the concept a bit better @arcticf0x the videos in udacity have increased in difficulty sufficiently in my opinion, and seem to be helping me, so that is what I've been using. In OCW Python was suggested as a starting point for programming as part of the comp sci prerequisite for their circuits course in MITx, so I took that as sufficient reason to accept Python as a decent starting point, so long as I focus on concepts rather than syntax.

    • 2 years ago
  20. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    http://norvig.com/21-days.html

    • 2 years ago
  21. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    (from that link): "Appendix: Language Choice Several people have asked what programming language they should learn first. There is no one answer, but consider these points: Use your friends. When asked "what operating system should I use, Windows, Unix, or Mac?", my answer is usually: "use whatever your friends use." The advantage you get from learning from your friends will offset any intrinsic difference between OS, or between programming languages. Also consider your future friends: the community of programmers that you will be a part of if you continue. Does your chosen language have a large growing community or a small dying one? Are there books, web sites, and online forums to get answers from? Do you like the people in those forums? Keep it simple. Programming languages such as C++ and Java are designed for professional development by large teams of experienced programmers who are concerned about the run-time efficiency of their code. As a result, these languages have complicated parts designed for these circumstances. You're concerned with learning to program. You don't need that complication. You want a language that was designed to be easy to learn and remember by a single new programmer. Play. Which way would you rather learn to play the piano: the normal, interactive way, in which you hear each note as soon as you hit a key, or "batch" mode, in which you only hear the notes after you finish a whole song? Clearly, interactive mode makes learning easier for the piano, and also for programming. Insist on a language with an interactive mode and use it. Given these criteria, my recommendations for a first programming language would be Python or Scheme. But your circumstances may vary, and there are other good choices. If your age is a single-digit, you might prefer Alice or Squeak (older learners might also enjoy these). The important thing is that you choose and get started. "

    • 2 years ago
  22. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    I don't think you need any programming to do the 8.002 MITx course. The physics course (Electricity and Magnetism) and Differential Equations (which in turn require basic Calculus) are more useful to spend time with if 6.002 is your main goal and you don't already have the knowledge down pat.

    • 2 years ago
  23. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    6.002, not 8.002

    • 2 years ago
  24. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    What do you mean by "the videos in udacity have increased in difficulty sufficiently in my opinion,"; don't you mean "decreased in difficulty"?

    • 2 years ago
  25. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    no, the exercises have become more difficult

    • 2 years ago
  26. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    infrastructure is also a concern. Most people will be using Windows (I do recommend getting comfortable with Linux, e. g. Ubuntu, and install it for dual-boot, to anyone who wants to get serious with programming), and just getting "hello world" out the door requires at least Visual Studio Express Edition, which totally overwhelms you (even me, but I know what to ignore :-) with options. Python makes it much easier because there is interactive mode, and on the Udacity course you can just do the quizzes in the browser (but I am repeating myself :-)

    • 2 years ago
  27. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    I dare FoolForMath to write a program in C with the same functionality as what you're working on in the Udacity course in the same time that the course participants write it :-) Okay, I'll shut up now ;-)

    • 2 years ago
  28. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    thank you very much for your input @nczempin it seems I still have much to sort out

    • 2 years ago
  29. sasogeek Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    LOL, that won't be quite a challenge considering he's quite vested with the language...

    • 2 years ago
  30. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    Ok, I guess what I meant that _I_ wouldn't be able to finish a bug-free version in C in less time than a bug-free Python version even though I know C much better than I do Python.

    • 2 years ago
  31. sasogeek Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    well that makes sense :)

    • 2 years ago
  32. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    @TuringTest I certainly don't want to discourage anyone from learning how to program, but my guess is you'll have your hands full with 6.002. I know I would. Given that, it's an excellent course, comparable to the SICP course in termns of "really learn the important concepts well". But who am I to judge that, I know far more about programming than I do about electronics.

    • 2 years ago
  33. FoolForMath Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    EDIT: (Removing personal information) @nczempin: 6 years as of now, I am fairly confident about my C and C++ language skill and moderately at python. Apart from ICPC training at my college I have practiced enormously at websites like topcoder,spoj, codechef and codeforces which gave me enough opportunity to write lots of non-trivial programs successfully in C, C++ and python.

    • 2 years ago
  34. nczempin Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    No, I meant large programs, such as those that take a man-year or more to write. What's the biggest one you had a significant role on? Are you a professional programmer or a student?

    • 2 years ago
  35. s3a Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Free concise ebook: http://www.swaroopch.org/notes/Python I recommend learning version 3. Edit: It seems this book has already been suggested. It's a concise read so if you're like me, you'll like this.

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.