<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Python Forum]]></title>
	<link rel="self" href="http://www.pythonforum.org/feed-atom.xml"/>
	<updated>2012-02-07T17:45:36Z</updated>
	<generator>PunBB</generator>
	<id>http://pythonforum.org/</id>
		<entry>
			<title type="html"><![CDATA[PyGame noob animation problem]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic510-pygame-noob-animation-problem-new-posts.html"/>
			<summary type="html"><![CDATA[<p>When I run the code I only see a black backround nothing more no ball, no animation. <br />Can someone please help me?</p><div class="codebox"><pre><code>bif=&quot;bb.jpg&quot; #black background#
mif=&quot;b.png&quot;   #ball#



import pygame, sys, glob
from pygame.locals import *

pygame.init()

screen=pygame.display.set_mode((640,360),0,32)
background=pygame.image.load(bif).convert()
ball=pygame.image.load(mif).convert_alpha()

x=0
clock=pygame.time.Clock()
speed=250
while True:

    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()

screen.blit(background, (0,0))
screen.blit(ball, (x, 160))

milli=clock.tick()
seconds=milli/1000.0
dm=seconds*speed
x+=dm

if x&gt;640:
    x=0
    
pygame.display.update()</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[TheNoob9]]></name>
				<uri>http://pythonforum.org/user766.html</uri>
			</author>
			<updated>2012-02-07T17:45:36Z</updated>
			<id>http://pythonforum.org/topic510-pygame-noob-animation-problem-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[HiEveryone!]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic508-hieveryone-new-posts.html"/>
			<summary type="html"><![CDATA[<p>You all already know my name(assuming u r reading my post) and I am here just to get help or provide some if I can. Since I am new to python and programming, I doubt that I can accomplish second one much at first times.Recently I came across MIT ocw Course 6.00 watched some lectures and it seemed really appealing and interesting.I hope there are lots of OCW fans here.</p>]]></summary>
			<author>
				<name><![CDATA[welldone_boy!]]></name>
				<uri>http://pythonforum.org/user764.html</uri>
			</author>
			<updated>2012-02-07T12:39:32Z</updated>
			<id>http://pythonforum.org/topic508-hieveryone-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[MIT OCW PROBLEM SET SERIES 4/n]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic506-mit-ocw-problem-set-series-4n-new-posts.html"/>
			<summary type="html"><![CDATA[<p>I have found really interesting the courses about Python at</p><p><a href="http://web.mit.edu">http://web.mit.edu</a></p><p>I have decided to submit my solutions to the suggested problems. I do not think mine the best solutions possible, here i share them with you with the hope to have usefull feedback.</p><p>You can find the text of the problem in the site that I suggested, i will not repeat it here.</p><p>Here is the code for ps2b.</p><div class="codebox"><pre><code>def largestNumberUnpurchasableMcNuggets(pack,limit):
    &quot;&quot;&quot;Largest number of McNuggets that cannot be bought in exact quantity&quot;&quot;&quot;

    def mcNuggets(requested,pack,limit):
        &quot;&quot;&quot;Complete search&quot;&quot;&quot;
        for q1 in range(0,limit/pack[0]+1):
            for q2 in range(0,limit/pack[1]+1):
                 for q3 in range(0,limit/pack[2]+1):
                     if pack[0]*q1+pack[1]*q2+pack[2]*q3 == requested:
                         return (q1,q2,q3)
        assert(False)

    n = limit
    while (n &gt; pack[0]-1):
        try:
            quantities = mcNuggets(n,pack,limit)
            n -= 1
        except:
            assert(n&lt;limit)
            return n
    return pack[0]-1

def problemSet2():
    &quot;&quot;&quot;McNuggets Diophantine equation&quot;&quot;&quot;

    pack = (6, 9, 20)
    limit = 200
    print &quot;Given package sizes&quot;,pack,&quot;the largest number of McNuggets that cannot be bought in exact quantity is:&quot;,largestNumberUnpurchasableMcNuggets(pack, limit)

    pack = (7, 13, 20)
    limit = 200
    print &quot;Given package sizes&quot;,pack,&quot;the largest number of McNuggets that cannot be bought in exact quantity is:&quot;,largestNumberUnpurchasableMcNuggets(pack, limit)

    pack = (9, 17, 20)
    limit = 200
    print &quot;Given package sizes&quot;,pack,&quot;the largest number of McNuggets that cannot be bought in exact quantity is:&quot;,largestNumberUnpurchasableMcNuggets(pack, limit)</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[5tarson]]></name>
				<uri>http://pythonforum.org/user756.html</uri>
			</author>
			<updated>2012-02-05T15:06:10Z</updated>
			<id>http://pythonforum.org/topic506-mit-ocw-problem-set-series-4n-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[MIT OCW PROBLEM SET SERIES 3/n]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic505-mit-ocw-problem-set-series-3n-new-posts.html"/>
			<summary type="html"><![CDATA[<p>I have found really interesting the courses about Python at</p><p><a href="http://web.mit.edu">http://web.mit.edu</a></p><p>I have decided to submit my solutions to the suggested problems. I do not think mine the best solutions possible, here i share them with you with the hope to have usefull feedback.</p><p>You can find the text of the problem in the site that I suggested, i will not repeat it here.</p><p>Here is the code for ps2a.</p><div class="codebox"><pre><code>def largestNumberUnpurchasableMcNuggets():
    &quot;&quot;&quot;Largest number of McNuggets that cannot be bought in exact quantity&quot;&quot;&quot;

    def mcNuggets(requested,pack,limit):
        &quot;&quot;&quot;Complete search&quot;&quot;&quot;
        for q1 in range(0,limit):
            for q2 in range(0,limit):
                 for q3 in range(0,limit):
                     if pack[0]*q1+pack[1]*q2+pack[2]*q3 == requested:
                         return (q1,q2,q3)
        assert(False)

    pack = (6, 9, 20)
    limit = 11
    n = 49
    while (n &gt; 5):
        try:
            quantities = mcNuggets(n,pack,limit)
            n -= 1
        except:
            return n
    return 5

def problemSet2():
    &quot;&quot;&quot;McNuggets Diophantine equation&quot;&quot;&quot;
    print &quot;Largest number of McNuggets that cannot be bought in exact quantity: &quot;, largestNumberUnpurchasableMcNuggets()</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[5tarson]]></name>
				<uri>http://pythonforum.org/user756.html</uri>
			</author>
			<updated>2012-02-05T11:35:32Z</updated>
			<id>http://pythonforum.org/topic505-mit-ocw-problem-set-series-3n-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Array changing values by itself!]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic504-array-changing-values-by-itself-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hi, I&#039;m brand new so I hope this is the right section!</p><p>I&#039;ve looked through my code and through extensive testing have located the section where the problem is occurring. Somehow, the array called &#039;gamemap&#039; is changing every time I press the update the screen, despite having no code that changes it at all. After testing different areas to see at what point the array is changing, I have located it to here. </p><br /><div class="codebox"><pre><code>def updateScroll():
    global grid, gamemap
    for i in range(rows):    
        for row in range(rows):
            grid[i][row] = gamemap[mapx+i][row]   </code></pre></div><br /><p>Ok basically what I&#039;m working with here is side scrolling game. I have a 20x20 display grid, and gamemap, which stores the entire map and procedurally generates more map, with is however long the map is x 20</p><p>mapx refers to the current position at the far left side of the display grid. It increases/decreases by one at every time you need to scroll left or right, currently controlled by the keyboard for testing. updateScroll goes through and takes a column of data from the gamemap at the position mapx and sticks it at the first column of the display grid, then takes the column from gamemap at position mapx+1 and puts it at the second column of the display grid and so on.</p><p>Any help gratefully received! Thanks for your time!</p>]]></summary>
			<author>
				<name><![CDATA[messd002]]></name>
				<uri>http://pythonforum.org/user761.html</uri>
			</author>
			<updated>2012-02-04T20:54:21Z</updated>
			<id>http://pythonforum.org/topic504-array-changing-values-by-itself-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[MIT OCW PROBLEM SET SERIES 2/n]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic503-mit-ocw-problem-set-series-2n-new-posts.html"/>
			<summary type="html"><![CDATA[<p>I have found really interesting the courses about Python at</p><p><a href="http://web.mit.edu">http://web.mit.edu</a></p><p>I have decided to submit my solutions to the suggested problems. I do not think mine the best solutions possible, here i share them with you with the hope to have usefull feedback.</p><p>You can find the text of the problem in the site that I suggested, i will not repeat it here.</p><p>Here is the code for ps1b.</p><div class="codebox"><pre><code>from math import *

def sumPrimesLogsTo(n):
    &quot;&quot;&quot;Computes the sum of logs of primes &lt; n&quot;&quot;&quot;

    def divisible(curr,d):
        &quot;&quot;&quot;Check if curr is divisible by an element of d&quot;&quot;&quot;
        for i in d:
            if (i &gt; sqrt(curr)):
                return False
            elif (curr % i == 0):
                return True
        return False

    def calculatePrimesLessThan(n):
        &quot;&quot;&quot;Computes the primes less then&quot;&quot;&quot;
        d = {1:2}
        d1 = {}
        idx = 2
        cnt = 1
        curr = 1+2*cnt
        while (curr &lt;= n):
            if (not divisible(curr,d1.values())):
                d1.update({idx:curr})
                idx += 1
            cnt += 1
            curr = 1+2*cnt
        d.update(d1)
        return d

    assert(n &gt; 2)
    assert(type(n)==type(1))
    d = calculatePrimesLessThan(n)
    res = 0.0
    for v in d.values():
        res += log(v)
    return res

def problemSet1():
    &quot;&quot;&quot;Verify for different values of n the sum of logs of primes &lt; n&quot;&quot;&quot;
    n = 3
    res = sumPrimesLogsTo(n)
    print &#039;Logs sum: &#039;,res, &#039;n: &#039;, n, &#039;ratio: &#039;, res/n
    n = 10
    res = sumPrimesLogsTo(n)
    print &#039;Logs sum: &#039;,res, &#039;n: &#039;, n, &#039;ratio: &#039;, res/n
    n = 100
    res = sumPrimesLogsTo(n)
    print &#039;Logs sum: &#039;,res, &#039;n: &#039;, n, &#039;ratio: &#039;, res/n
    n = 1000
    res = sumPrimesLogsTo(n)
    print &#039;Logs sum: &#039;,res, &#039;n: &#039;, n, &#039;ratio: &#039;, res/n
    n = 10000
    res = sumPrimesLogsTo(n)
    print &#039;Logs sum: &#039;,res, &#039;n: &#039;, n, &#039;ratio: &#039;, res/n
    n = 100000
    res = sumPrimesLogsTo(n)
    print &#039;Logs sum: &#039;,res, &#039;n: &#039;, n, &#039;ratio: &#039;, res/n</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[5tarson]]></name>
				<uri>http://pythonforum.org/user756.html</uri>
			</author>
			<updated>2012-02-04T12:43:37Z</updated>
			<id>http://pythonforum.org/topic503-mit-ocw-problem-set-series-2n-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[MIT OCW PROBLEM SET SERIES 1/n]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic502-mit-ocw-problem-set-series-1n-new-posts.html"/>
			<summary type="html"><![CDATA[<p>I have found really interesting the courses about Python at</p><p><a href="http://web.mit.edu">http://web.mit.edu</a></p><p>I have decided to submit my solutions to the suggested problems.<br />I do not think mine the best solutions possible, here i share them with you with the hope to have usefull feedback.</p><p>You can find the text of the problem in the site that I suggested, i will not repeat it here.</p><p>Here is my code for ps1a.</p><div class="codebox"><pre><code>from math import *

def defineIthPrime(position):
    &quot;&quot;&quot;Computes the ith prime number&quot;&quot;&quot;

    def divisible(curr,d):
        &quot;&quot;&quot;Check if curr is divisible by an element of d&quot;&quot;&quot;
        for i in d:
            if (i &gt; sqrt(curr)):
                return False
            elif (curr % i == 0):
                return True
        return False

    def calculateIthPrime(position):
        &quot;&quot;&quot;Computes the 1:ith prime number&quot;&quot;&quot;
        d = {1:2}
        d1 = {}
        idx = 2
        cnt = 1
        curr = 1+2*cnt
        while (idx &lt;= position):
            if (not divisible(curr,d1.values())):
                d1.update({idx:curr})
                idx += 1
            cnt += 1
            curr = 1+2*cnt
        d.update(d1)
        return d

    assert(position &gt; 0)
    assert(type(position)==type(1))
    d = calculateIthPrime(position)
    return d[position]

def problemSet1():
    &quot;&quot;&quot;Computes and prints the 1000th prime number&quot;&quot;&quot;
    result = defineIthPrime(1000)
    print &quot;The 1000th prime number is &quot;, result</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[5tarson]]></name>
				<uri>http://pythonforum.org/user756.html</uri>
			</author>
			<updated>2012-02-04T12:37:55Z</updated>
			<id>http://pythonforum.org/topic502-mit-ocw-problem-set-series-1n-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Kindly review my site...]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic501-kindly-review-my-site-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hello friends,</p><p>Kindly review my new<br /> <a href="http://www.tanyaroy.com/">Mumbai escorts</a> Website – <a href="http://www.tanyaroy.com/">http://www.tanyaroy.com/</a><br />Your comments and suggestions are required to enhance it better.<br />pls comments if you like the website.</p><p>Warm regards,<br />Tanya Roy</p>]]></summary>
			<author>
				<name><![CDATA[mariathomos123]]></name>
				<uri>http://pythonforum.org/user758.html</uri>
			</author>
			<updated>2012-02-02T06:35:44Z</updated>
			<id>http://pythonforum.org/topic501-kindly-review-my-site-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[help me, error import module]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic500-help-me-error-import-module-new-posts.html"/>
			<summary type="html"><![CDATA[<p>hi everybodyi need user sequitur g2p and i installed it , when i run g2p.py then error:</p><p> python2.7 g2p.py --train train.lex --devel 5% --write-model model-1<br />Traceback (most recent call last):<br />&nbsp; File &quot;g2p.py&quot;, line 38, in &lt;module&gt;<br />&nbsp; &nbsp; import SequiturTool<br />ImportError: No module named SequiturTool<br />and <br />i installed sequitur g2p to /usr/local/install/g2p/<br />and i run g2p.py in : ./g2p/bin/<br />and i fond file SequiturTool.py in ./g2p/lib64/python2.7/site-packages/<br />so how to when i run g2p.py than it find SequiturTool.py<br />pls, help me</p>]]></summary>
			<author>
				<name><![CDATA[namdt40]]></name>
				<uri>http://pythonforum.org/user757.html</uri>
			</author>
			<updated>2012-02-02T05:47:36Z</updated>
			<id>http://pythonforum.org/topic500-help-me-error-import-module-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Clueless Novice]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic499-clueless-novice-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hello everyone,</p><p>Being as green as the man who invented the the word green, i wonder if you could point me in the right direction please.</p><p>I have installed the latest python 3.2.2, and the open source book <span class="bbu">A byte of python.</span></p><p>Unfortunately i am falling at the first hurdle, the test program <em>Hello World.,</em> i believe i have entered it correctly in a new window in the IDLE editor, saving as helloworld.py as the book suggests, but get syntax errors when trying to run.</p><p>As follows:</p><p>#!usr/bin/python</p><p>#Filename: helloworld.py</p><p>print(&#039;Hello World&#039;)</p><br /><p>The output should be:</p><br /><p>$ python helloworld.py</p><p>Hello World</p><br /><p>Attempting to run this in either python command line or IDLE shell returns errors. Is it me or the book?</p><p>Thanks in anticipation.</p><p>~Darren~</p>]]></summary>
			<author>
				<name><![CDATA[Daz1966]]></name>
				<uri>http://pythonforum.org/user754.html</uri>
			</author>
			<updated>2012-01-31T08:28:53Z</updated>
			<id>http://pythonforum.org/topic499-clueless-novice-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA['return' in function working in idle but not when run from source file]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic497-return-in-function-working-in-idle-but-not-when-run-from-source-file-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hey, I have this function(for a hangman game) which takes the users input of a word, then converts that to a list. I use the len function to find the number of letters in that list, set it to a variable, then try and call that value in a formatted string. In idle, it returns the correct value, but from a source file no value is returned. Anybody know why and how to change that?</p><p>Code:</p><p>theletters=[]</p><p>def filler():</p>]]></summary>
			<author>
				<name><![CDATA[Phlebas]]></name>
				<uri>http://pythonforum.org/user735.html</uri>
			</author>
			<updated>2012-01-30T17:13:19Z</updated>
			<id>http://pythonforum.org/topic497-return-in-function-working-in-idle-but-not-when-run-from-source-file-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[deleting a folder within a folder]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic496-deleting-a-folder-within-a-folder-new-posts.html"/>
			<summary type="html"><![CDATA[<p>I&#039;ve got multiple branches in the company folder and then multiple users per branch. I need to remove certain users as they leave a branch. I don&#039;t get an error but the entire branch folder gets deleted and not just the specified user folder. Can someone point me in the right direction</p><div class="codebox"><pre><code>#!/usr/bin/python
import os, sys, getopt, shutil
branch, user = &quot;&quot;,&quot;&quot;

if __name__ == &quot;__main__&quot;:
    argv = sys.argv[1:]
    try:
       opts, args = getopt.getopt(argv, &#039;hd:e&#039;, [&#039;help&#039;, &#039;branch=&#039;, &#039;user=&#039;])
    except getopt.GetoptError:
       print __doc__
       sys.exit()

    for opt, arg in opts:
       if opt in (&#039;-h&#039;, &#039;--help&#039;):
           print __doc__
           sys.exit()
       if opt in (&#039;-d&#039;, &#039;--branch&#039;):
           branch = arg
       if opt in (&#039;-e&#039;, &#039;--user&#039;):
           user = arg

shutil.rmtree(&quot;/home/company/%s/%s&quot; % (branch , user))</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[peter5556]]></name>
				<uri>http://pythonforum.org/user751.html</uri>
			</author>
			<updated>2012-01-27T08:51:25Z</updated>
			<id>http://pythonforum.org/topic496-deleting-a-folder-within-a-folder-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Unicode filepath to module]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic495-unicode-filepath-to-module-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Hi.<br />I use python 2.7.1 in my project, written in c++. I have problem with module importing when path to it contains unicode symbols - PyImport_ImportModule fails. Application and python lib (linked as static) projects have option &quot;Use Multi-Byte Character Set&quot;. I use VS2010, Win7.<br />Please help me to solve localization problem.</p>]]></summary>
			<author>
				<name><![CDATA[sv161]]></name>
				<uri>http://pythonforum.org/user749.html</uri>
			</author>
			<updated>2012-01-27T07:27:51Z</updated>
			<id>http://pythonforum.org/topic495-unicode-filepath-to-module-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[program that inverts strings of binary numbers.......help needed]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic494-program-that-inverts-strings-of-binary-numbershelp-needed-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Write a program that inverts the string of binary numbers. Invert the 0’s to 1’s and 1’s to ‘0<br />e.g. binary=”010101011001100011”<br />output: “101010100110011100”</p>]]></summary>
			<author>
				<name><![CDATA[saadshahhussain]]></name>
				<uri>http://pythonforum.org/user750.html</uri>
			</author>
			<updated>2012-01-26T20:24:31Z</updated>
			<id>http://pythonforum.org/topic494-program-that-inverts-strings-of-binary-numbershelp-needed-new-posts.html</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Python Developer Position Newcastle - UK]]></title>
			<link rel="alternate" href="http://pythonforum.org/topic493-python-developer-position-newcastle-uk-new-posts.html"/>
			<summary type="html"><![CDATA[<p>Job title:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Python Developer</p><p>Salary:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; £18,000 - £20,000 + Bonuses (OTE £26,000)</p><p>Job description<br />Our client are a software solution provider in the Education sector. They are constantly looking to develop their client offering and as a result they are looking to recruit a new Python developer to join the team. Reporting to the lead developer you will assist with the development of our web-based accounting and online payment system. You will be assisted by additional developers, a designer and a QA team but you’ll be responsible for managing your part of the project and meeting the code quality standards required for release. </p><p>Personal requirements<br />•&nbsp; &nbsp; You will be required to have good skills and experience in Python and Django for the application development.<br />•&nbsp; &nbsp; Preferable skills in HTML5/CSS3/JavaScript/jQuery/Flask/NginX.<br />•&nbsp; &nbsp; You will have a strong track record of delivering completed projects, preferably web-based.<br />•&nbsp; &nbsp; You will have good organisation, time management and communication skills.<br />•&nbsp; &nbsp; You will also need the flexibility to adapt to a changing schedule and priorities in a fast-paced environment.<br />•&nbsp; &nbsp; You will have good design and analysis skills for scoping, designing and implementing a solution.<br />•&nbsp; &nbsp; Applicants that pass the interview stage will be required to work a two day trial in the Newcastle offices to demonstrate their skills and experience a typical working day.</p><p>Applicants that are interested in this position, please send a current CV to hello@jobhathq.com</p>]]></summary>
			<author>
				<name><![CDATA[JobHAT]]></name>
				<uri>http://pythonforum.org/user748.html</uri>
			</author>
			<updated>2012-01-26T14:09:40Z</updated>
			<id>http://pythonforum.org/topic493-python-developer-position-newcastle-uk-new-posts.html</id>
		</entry>
</feed>

