![]() |
|
Re: ** Python Support Thread **
If Udacity is 7 or 8 class modules compared to MIT's 24 classes, so yes, the MIT class is probably much more thorough. As for finding answers to 6.000, there are quite a few (poorly done) answers found online.
6.000 has a pretty specific goal of preparing you for 6.001 (Structure and Interpretation of Computer Programs). The approach is, from what I can remember, pretty CS-heavy and not particularly focused on Python: in fact the professor is pretty vocal about his contempt toward the language. Some quotes I remember: "I hate this friggin' language." "Ooops, I thought I was writing Lisp." "I'm a Lisp hacker, so using this language is..." "I ~hate~ this (operation overload / whatever feature)." "This is how Python handles lists, which isn't so bad, but (long mind-blowing dissertation in how Lisp handles lists) which is far better." Unfortunately, he didn't teach the OO part of the class. I'm sure that would have been wildly entertaining. (OO is pretty controversial in Lisp programming and generally frowned upon) Sounds like an awful teacher, but he was actually really really good. There were a few classes I had to watch twice to understand it. At the time of taking this course, I didn't have a job, so I finished it in one month, but with a job, it would've taken me 3 to 5 months. So, with time constraints and stuff, Udacity's shorter format is probably a good option. As for the problem in question: It's find the 1001st prime. I guess to weigh the speed (and perhaps quality?) of each class, figure out how far you'd have to be in Udacity before they would introduce that question. |
Re: ** Python Support Thread **
Putting the actual content aside, Udacity's delivery method is MUCH better. OCW has no interactivity. Udacity prompts the students to answer questions and actually write code. That's more interactivity than most students (the ones who sit in the back and don't raise their hand) get actually attending MIT lectures. Udacity actually feels like the professor is tutoring me personally. I'm a fan.
|
Re: ** Python Support Thread **
Sorry if I misled anybody. I was just seconding an opinion that Udacity is pretty good. I don't know anything about the MIT program.
|
Re: ** Python Support Thread **
Quote:
Ohh, yeah, I finally got that. I wrote a code to write down the odd numbers and now I am trying to figure out how to determine if the odd number is prime or not. I can do it on paper, and I know I probably have to use the a%b, but it just doesn't seem to be coming out. I'll keep working at it D:<! |
Re: ** Python Support Thread **
So I had this to find the odd number,
Quote:
and then i tried this to find the prime number Quote:
|
Re: ** Python Support Thread **
Use <code> tags so we can see your indentation
|
Re: ** Python Support Thread **
You need to use code tags to format the code you are asking about. I'm not really sure if you are nesting loops or if you are writing consecutive loops. With that said:
Yes, the output should be 11 because the code did exactly what you told it to do. Did you get to the part where he is at the chalk board and charting out the looping function i/o? Do the same on a pencil and paper. |
Re: ** Python Support Thread **
Code:
odd_number=-1Thanks for all of the help guys :D! I really appreciate it! |
Re: ** Python Support Thread **
Try printing the value of x inside the loop so you can see for yourself what it's doing.
|
Re: ** Python Support Thread **
Quote:
Does the while loop feel stupid right now? Sure, since all you're trying to do is count some numbers, but soon you will have zero options but to use the while loop and unless you can learn to generate a basic counter with it, you're not going to be able to understand why other stuff is breaking. If you're going to make it through this class, you must learn to do two things: 1- Pencil and Paper. I know, sounds primitive, so if you prefer: "back of the envelope computations." 2- Create toy programs. Trying to create a fully functioning program, as you are now hopefully discovering, isn't at all possible until you understand the components of each piece you are writing. To gain insight, you must create toy programs. Copy / paste these into your IDLE, then type each one (these won't work due to indent errors) and see what they output, and try to understand why they work. Once you ~think~ you understand the codes, try creating your own toy codes and see if the output you expected to see is what you get. If not, try to find out why: Code:
x = 1If at this point of the class, you have not been introduced to for loop, then you should probably try to do this hw in while loops only. I think it's worth the effort. |
Re: ** Python Support Thread **
Quote:
Code:
print range(1,11) |
Re: ** Python Support Thread **
i am using python and sqlite3 to make a database and analyze the information. can i get some tips on database design please? the data is there are 21 turtles and there are measurements taken on their shell length, width, and weight, and these measurements were all taken 5 different times one week apart. how do i structure this data?
|
Re: ** Python Support Thread **
Would probably just do a couple tables like:
Code:
Table Turtles: |
Re: ** Python Support Thread **
Sounds like all you need is one table with these fields:
TurtleID, MeasurementDate, Length, Width, Weight Edit: Neko is correct. Add the second table for the turtle info. |
Re: ** Python Support Thread **
lol thanks for some reason i was thinking need a new table for each measurement date. it seems like database work could get complex though if you have a lot of data
|
Re: ** Python Support Thread **
well as long as im here, here is another question. so i have this table in sqlite with a column of data type REAL, yet when i run a SELECT command and get the data and do c.fetchall() or c.fetchone() it returns me the correct number but as data type "none type" so i cant manipulate the number. how do i get the data as a REAL
|
Re: ** Python Support Thread **
It's more likely returning it as a string then untyped. You should be able to change to a float/real by doing:
Code:
x = "123.4" |
Re: ** Python Support Thread **
oh i see it is returning it as a list so i just have to get first element of list. sorry kind of dumb question i am just burning out now and i'm a newbie programmer
|
Re: ** Python Support Thread **
do you guys use gspread or gdata library?
|
Re: ** Python Support Thread **
kind of annoying if i do gspread.range it returns numbers turned into text strings with the cell number in text.
found this it helps, sales_data = [float(c.value) for c in worksheet.range('E1:E17')] |
Re: ** Python Support Thread **
Code:
q=1So 2 is the first prime number 3 is the second etc. HALP. |
Re: ** Python Support Thread **
Excuse my french. Just having a little fun with the program.
|
Re: ** Python Support Thread **
It doesn't seem to work:
Code:
>>> 1- Do really need to divide by every single number up to the candidate? 2- Do you know how to find the 1001st prime yet? If not, then try that first, then do this one. |
Re: ** Python Support Thread **
what do you use for parsing HTMl with python? beautiful soup, elementtree, just regex?
|
Re: ** Python Support Thread **
I've never used beautiful soup or elementtree, but the answer is not regex.
|
| All times are GMT -4. The time now is 07:41 AM. |
|
Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright © 2008-2020, Two Plus Two Interactive