Beginning with Python; the right choice?
Hi, As you can imagine, I am new, both to this group and to Python. I have read various posts on the best book to buy or online tutorial to read and have started to go through them. I was wondering, as someone with virtually no programming experience (I am a photographer by trade), is Python the right language for me to try and learn? I do vaguely remember learning what I think was BASIC on some old Apple's back in elementary school (circa 1992). Would something like that (the name at least makes it SOUND easier) be more feasible? If I do choose to learn Python, are there any tutorials for the absolute beginner. I do not mean beginner to Python, but rather, beginner to programming. Someone who hasn't a clue what object oriented whatcha-ma-whoozit means. I ask again because I understand that content is always evolving and there might be new tutorials out there. Thanks! -Daniel Sato -- http://mail.python.org/mailman/listinfo/python-list
Re: Beginning with Python; the right choice?
Thank you for all of the links and advice. What do I want to learn Python for? Again, pardon me for my lack of relevant information. I am also a journalist (an out of work one at the moment, like so many others) and I feel that learning python could be useful for computer assisted reporting, that is, utilizing databases, creating interactive maps and the like. http://chicago.everyblock.com/crime/ I also am fond of the Ellington Content Management System, made using django, which, if I am not mistaken, is related to Python...in...some...way..lol. I'll figure it out? Any additional advice now that you know what I want to learn and why would be greatly appreciated. Oh and, if you need a photographer, www.danielsato.com! thanks again! -daniel -- http://mail.python.org/mailman/listinfo/python-list
MIT OpenCourseWare Introduction to Computer Science and Programming
I am wondering if anyone else is also going through the MIT OpenCourseWare Intro to CS class. http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-00Fall-2007/CourseHome/index.htm I've been doing the assignments and, as this class didn't include any answer key, was hoping to see what others did and perhaps collaborate on assignments. -Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: MIT OpenCourseWare Introduction to Computer Science and Programming
I should note that the course utilized python when teaching computer science. On Jun 30, 5:23 pm, "sato.ph...@gmail.com" wrote: > I am wondering if anyone else is also going through the MIT > OpenCourseWare Intro to CS class. > > http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science... > > I've been doing the assignments and, as this class didn't include any > answer key, was hoping to see what others did and perhaps collaborate > on assignments. > > -Daniel -- http://mail.python.org/mailman/listinfo/python-list
Basic question from pure beginner
I have been going through some Python Programming exercises while following the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with the first "If" exercise listed on this page: http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements#If_Exercises I have been able to make the module quit after entering a password three times, but can't get it to quit right away after the correct one is entered. I know this is really basic, please forgive me. I have no programming experience and have just started going through these tutorials. My code is here: http://python.pastebin.com/m6036b52e -daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: Basic question from pure beginner
Thank you for all of the help. With your assistance and help from the Python Tutor mailing list I was able to come up with the following code: password = "qwerty" correct_password_given = False guess = "0" count = 0 while count != 3 and not correct_password_given : guess = raw_input("Enter your password: ") guess = str(guess) if guess != password: print "Access Denied" count = count + 1 else: print "Password Confirmed" correct_password_given = True If I understand it correctly, the function will continue to loop until either the count == 3 or until correct_password_give = True, satisfying the two conditions of the assignment, which were to lock a user out after three failed password attempts and to print "Access Granted" and end the module if the correct password is given. Am I understanding this correctly? Thanks! On Jul 1, 12:06 am, alex23 wrote: > On Jul 1, 3:38 pm, "sato.ph...@gmail.com" > wrote: > > > I have been able to make the module quit after entering a password > > three times, but can't get it to quit right away after the correct one > > is entered. > > Not with the code you pasted, you haven't. There's a missing colon on > line 7 & line 9 isn't indented properly. It's always best if we're > referring to the same source when trying to help with a problem. > > The problem you're having, though, has to do with the while loop and > the fact that it's only checking one condition: has the 'count' > counter been incremented to 3. What you need to do is _also_ check for > the success condition: > > is_confirmed = False > while count != 3 or is_confirmed: > guess = raw_input("Enter your password: ") > guess = str(guess) > if guess != password: > print "Access Denied" > count = count + 1 > else: > print "Password Confirmed" > is_confirmed = True > > This also provides you with a nice boolean that shows whether or not > the password was confirmed, which may be useful for latter code. > > However, whenever you want to loop a set number of times, it's usually > better to use a 'for' loop instead: > > PASSWORD = 'qwerty' > MAXRETRY = 3 > for attempt in xrange(MAXRETRY): > guess = str(raw_input('Enter your password: ')) > is_complete = guess == PASSWORD > if is_complete: > print 'Password confirmed' > break # this exits the for loop > else: > print 'Access denied: attempt %s of %s' % (attempt+1, MAXRETRY) > > This saves you from the burden of creating, incrementing & testing > your own counter. > > If there's anything here that isn't clear, please don't hesitate to > ask. -- http://mail.python.org/mailman/listinfo/python-list