[closed] Python code for class quiz

As a Python beginner I find it useful to have the code for class quiz in front of me when I write code for a new problem. Unfortunately, only a portion of the code for the quiz is generally shown in the video and once I move to the next topic even that is lost! I would like to save the full code for all the quiz to help me learn this language. Is there a way to view the "full" code, save, and download it?

I have installed Python 3.2 for Windows on my PC.

asked 27 Feb '12, 20:43

jayesh%20dalal's gravatar image

jayesh dalal
1693415

accept rate: 8%

closed 28 Feb '12, 20:35

It is definitely gratifying to have so many responses for my request for help. More I think about my needs I believe this my question needs to be addressed directly to the COURSE MODERATOR. I believe he is in a position to truly help by making the quiz solution codes available for download/saving.

Most of the answers mention differences between the 3.2 and 2.7/2.7 versions of Python. However, my corrent problem is not with the version; it is with not having an easy access to the ful solution code! Yes, as it has been suggested by some, I can type in the code in a separately file on an on going basis. However, I prefer to have a less painful alternative.:)

I am hoping that the Moderator will seem if fit to response to this issue. I would like to thionk that i am not the only one with this need.

As for voting, I am not sure what is this about! Sorry, I am new to this game.

(28 Feb '12, 12:19)

jayesh dalal

jayesh%20dalal's gravatar image

The question has been closed for the following reason "The question is answered, right answer was accepted" by jayesh dalal 28 Feb '12, 20:35


4 Answers:

I think the best solution is to save your code in a file as you go, and cut and paste to and from the browser interactive shell as needed.

Also, be aware that the syntax for Python3 is slightly different than Python2.6, which is the Python used for this class. For example, print is a function in Python3 (so it needs parentheses), but it is a statement in Python2 (so no parentheses needed). There are many other diferences as well (/ returns floats in Python3, but integers in Python2, some methods that return iterators in Python3 return lists in Python2, unbound methods are gone, no more silent conversion between unicode and bytes, etc).

I think your life will be a little easier if you install Python2.6 or Python2.7 instead since that would eliminate a possible source of discrepancies.

link

answered 27 Feb '12, 20:47

Alan%20Ho's gravatar image

Alan Ho
11.4k53056

edited 27 Feb '12, 21:18

I have been doing each assignment in a separate source file like Unit1-5.py, etc.
So I start by doing a copy/paste from the browser/video window to my local editor.
Once it is working, I paste it back in to the browser window to run and submit it.

If you are very very new to python then, pasting it into an online tool where you can step through the code and visualize what is happening may be a useful intermediary step.

Then all my source files are committed to my mercurial repository for source control and pushed to my private repository on bitbucket (so I can access it from multiple computers and locations).
This will help me later if and when I need to review any of the source.

link

answered 27 Feb '12, 21:23

EdG's gravatar image

EdG
7.2k3838

Course notes contain the code that is in the videos, you can find them in the supplementary material below the video player.

But do not use python 3.2: the course uses 2.7 (or 2.6) and the syntax in some cases is different, for instance the print function is different, so you'd better install python 2.7 too

link

answered 27 Feb '12, 20:49

Anna-Chiara%20Bellini's gravatar image

Anna-Chiara ...
5.2k103175

Thanks. I checked your suggestion and clicked on the "Supplementary Material" when viewing Lesson 1.21 -Inexact Move Function. There was no code listed here!

(28 Feb '12, 12:26)

jayesh dalal

jayesh%20dalal's gravatar image

Why not using an IDE such as Eclipse with pyDev plugin where you can save code into a project as you progress through the course? I find that doing this helps me get to reference the code an see it grow quickly without having to search through previous units/lessons.

link

answered 27 Feb '12, 21:19

jaizen's gravatar image

jaizen
105210

Thanks. You are talking to a new commer here. I have no idea what "IDE such as Eclipse with prDev plugin" is, where one can find it, and how to use it. Besides, it seems more work than necessary if the full solution code for quiz is made available as a file.

(28 Feb '12, 12:29)

jayesh dalal

jayesh%20dalal's gravatar image

haha sorry about that. Eclipse is a popular integrated development enviroment which help you to code. It has many features such as code complete which help you in your coding as opposed to directly writing the code in a file and running it from command line utils.
pyDev is a plugin for Eclipse that help in python development on Eclipse.
You can download Eclipse here: http://www.eclipse.org/downloads/packages/eclipse-classic-372/indigosr2

And pyDev here: http://pydev.org/

There are other development environments you can consider as well. Check out a previous post here: http://www.udacity-forums.com/cs373/questions/110/good-python-ide

saving files as you go in your local machine and having access to then via an IDE helps you quickly search, use, modify and run them, IMO.

(28 Feb '12, 15:34)

jaizen

jaizen's gravatar image

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags

×7,472
×2,214
×502
×482

Asked: 27 Feb '12, 20:43

Seen: 749 times

Last updated: 28 Feb '12, 20:35