Hi Emile, Re-install your vpython and make sure you select ''C:\Python32'' as install location and not ''C:\Python32\New Folder'' or any other.
Cheers, Abasiemeka On Wed, Jul 4, 2012 at 5:57 PM, <tutor-requ...@python.org> wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to > tutor-requ...@python.org > > You can reach the person managing the list at > tutor-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > > 1. Re: VPYTHON (Emile van Sebille) > 2. Re: Passing numeral result of a defined function to a named > value (Emile van Sebille) > 3. Re: for loop question (Emile van Sebille) > 4. Bothersome NoneType Error for a List object (Osemeka Osuagwu) > 5. Re: Bothersome NoneType Error for a List object (Steven D'Aprano) > 6. Re: Seeking help with reading and writing files in Python > (Alan Gauld) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 04 Jul 2012 07:53:14 -0700 > From: Emile van Sebille <em...@fenx.com> > To: tutor@python.org > Subject: Re: [Tutor] VPYTHON > Message-ID: <jt1lfi$b59$1...@dough.gmane.org> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 6/27/2012 3:59 PM Prajwal Niraula said... > > Hi, > > I am trying to learn VPython for more interesting simulation. I > > downloaded it from the website: www.vpython.org <http://www.vpython.org> > > While I have Python 3.2.3 in my computer, and it seems no equivalent > > version for vpython is available. Besides when installing I had problem > > in which the installer would not recognise the location of python, even > > though it is located at C:\Python32. > > What should I be doing? > > Sign up for their mailing list at > https://lists.sourceforge.net/lists/listinfo/visualpython-users > and ask them. > > Emile > > > > ------------------------------ > > Message: 2 > Date: Wed, 04 Jul 2012 08:09:14 -0700 > From: Emile van Sebille <em...@fenx.com> > To: tutor@python.org > Subject: Re: [Tutor] Passing numeral result of a defined function to a > named value > Message-ID: <jt1mdi$knr$1...@dough.gmane.org> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 6/28/2012 11:51 PM Joseph Hines said... > > Hello. Sorry to bother you, but I'm self-teaching myself python, and > > having difficulty with a script I'm writing to auto-calc various derived > > stats for a PnP game I am hosting soon. > > > > I need to pass a numeral result of a defined function to a "named" value > > (not sure if that's what it's called) > > > > The offending segment of code is this: > > > > ... and what's the offending error? (provide traceback details please) > > Do you mean to be defining a function within a try-except structure? As > it stands you'll get a syntax error. > > You've likely got an indetation issue on the line before except. > > providing int_mod as some integer and reworking it to: > > XP_Per_Level_Base = 20-int_mod > XP_Per_Level_Limit = 5 > try: > def XP_Per_Level_Calc(XP_Per_Level_Base, XP_Per_Level_Limit): > if XP_Per_Level_Base < XP_Per_Level_Limit: > return XP_Per_Level_Limit > else: > return XP_Per_Level_Base > except ValueError: > print "Script B0RK3D, Link Shall Come to Town." > print "send him a message at > link6...@gmail.com<mailto:link6...@gmail.com>" > > > XP_Per_Level = XP_Per_Level_Calc(XP_Per_Level_Base, XP_Per_Level_Limit) > > gets it going, dut all in all it looks to me like this is simply a max > function and could be written more simply as: > max(XP_Per_Level_Base,XP_Per_Level_Limit) > > Emile > > > > > > XP_Per_Level_Base = 20-int_mod > > XP_Per_Level_Limit = 5 > > try: > > def XP_Per_Level_Calc(XP_Per_Level_Base, XP_Per_Level_Limit): > > if XP_Per_Level_Base < XP_Per_Level_Limit: > > return XP_Per_Level_Limit > > else: > > return XP_Per_Level_Base > > XP_Per_Level = XP_Per_Level_Calc(XP_Per_Level_Base, > XP_Per_Level_Limit) > > except ValueError: > > print "Script B0RK3D, Link Shall Come to Town." > > print "send him a message at link6...@gmail.com > > <mailto:link6...@gmail.com>" > > > > #Calcs XP per Level# > > > > > > If you need the whole script, I'd be glad to send it to you, just > > promise me not to divulge too many details of it > > (It's regarding a custom PnP system that I'm planning on releasing under > > the Open Gaming License, and I'd prefer not to risk it becoming a > > proprietary system for someone I don't know) > > > > > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > To unsubscribe or change subscription options: > > http://mail.python.org/mailman/listinfo/tutor > > > > > ------------------------------ > > Message: 3 > Date: Wed, 04 Jul 2012 08:30:07 -0700 > From: Emile van Sebille <em...@fenx.com> > To: tutor@python.org > Subject: Re: [Tutor] for loop question > Message-ID: <jt1nko$v1v$1...@dough.gmane.org> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 7/1/2012 2:50 PM Jim said... > > Hello Friends, > > I apologize for being such a bother. This problem has been evading me > > all day. Can you please give me a hint as to why I cannot put the > > variable UpperCaseSentence outside of the for loop? > > I can do it in other instances but not in this one. > > Thank you so much, > > Jim > > > > You're not returning anything from fixCase -- change the final print to > return and try it again. > > Emile > > > > > > > #Main function. > > def main(): > > mySentence = (input("Enter text.")) > > mySentenceList = mySentence.split('.') > > > > #Call fixCase function. Send it mySentenceList and receive result > > #and stores result in variable named output. > > output = fixCase(mySentenceList) > > print(output) > > > > def fixCase(myList): > > #Begin making a loop through the list, using a variable myString > > for myString in range (len(myList)): > > tempString = myList[myString] #Store in temporary variable. > > myList[myString] = tempString[0:1].upper() + > tempString[1:len(tempString)] #Replace with upper > > UpperCaseSentence = (myList[myString]) > > print(UpperCaseSentence) > > > > #Call main function > > main() > > > > > > ------------------------------ > > Message: 4 > Date: Wed, 4 Jul 2012 17:01:34 +0100 > From: Osemeka Osuagwu <abasiem...@gmail.com> > To: tutor@python.org > Subject: [Tutor] Bothersome NoneType Error for a List object > Message-ID: > < > caf33e7zaobinfag4+lyg218q6o4hwagorzmzvybr-i19rwh...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > Hi, > I am trying to find the smallest positive number that is divisible by all > of the numbers from 1 to 20 without a remainder. I wrote the following code > (implementation of a solution method found in > http://en.wikipedia.org/wiki/Least_common_multiple#A_method_using_a_table) > but kept getting an error message (also posted) when I ran it. I can't > figure out the problem. I would appreciate help with this. Also, any hint > on how to make the code more elegant is welcome. > > Regards, > Abasiemeka > > *CODE* > def checkdiv(x, testlist): #returns True if x can divide ANY member of > testlist,returns False otherwise > for k in testlist: > if k%x == 0: > return True > return False > > def lcm(numlist): #continuously divides numlist by each in a > list of prime numbers till cannot > primeslist = [2, 3, 5, 7, 11] > templist = [] > > for prime in primeslist: > if checkdiv(prime, numlist) == True: > templist = templist.append(prime) > for i in range(0,len(numlist)): > if numlist[i]%prime == 0: > numlist[i] = numlist[i]/prime > else: > pass > > lcm = reduce(lambda x, y: x*y, templist) #my first lambda > expression! (multiply all members of templist > return lcm > > print lcm([i for i in range(1, 21)]) > > *ERROR OUTPUT* > Traceback (most recent call last): > File "C:\Windows.old\Users\Abasiemeka\Abasiemeka\GOOGLE > University\Python\Python Code\MyCode\Project Euler code\Project Euler > answer 5.py", line 31, in <module> > print lcm(first20) > File "C:\Windows.old\Users\Abasiemeka\Abasiemeka\GOOGLE > University\Python\Python Code\MyCode\Project Euler code\Project Euler > answer 5.py", line 20, in lcm > templist = templist.append(prime) > AttributeError: 'NoneType' object has no attribute 'append' > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/tutor/attachments/20120704/1cac9413/attachment-0001.html > > > > ------------------------------ > > Message: 5 > Date: Thu, 05 Jul 2012 02:15:08 +1000 > From: Steven D'Aprano <st...@pearwood.info> > To: tutor@python.org > Subject: Re: [Tutor] Bothersome NoneType Error for a List object > Message-ID: <4ff46c0c.4000...@pearwood.info> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Osemeka Osuagwu wrote: > > > templist = templist.append(prime) > > The append method operates in place, and returns None. It doesn't return a > list: > > py> mylist = [] > py> x = mylist.append(42) > py> x is None > True > py> mylist > [42] > > Replace that line with just > > templist.append(prime) > > > -- > Steven > > > ------------------------------ > > Message: 6 > Date: Wed, 04 Jul 2012 17:56:51 +0100 > From: Alan Gauld <alan.ga...@btinternet.com> > To: tutor@python.org > Subject: Re: [Tutor] Seeking help with reading and writing files in > Python > Message-ID: <jt1skj$89p$1...@dough.gmane.org> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 26/06/12 19:28, Aristotle wrote: > > > with an assignment that asks me to read from one file and then write to > > another file. The problem is that the file to read from has not been > > created yet. > > So create it. > Any old text editor will do. > The whole point is, I believe that you are writing a program to read a > file created by some other application, perhaps a web application or > database reporting tool. (or in this case Notepad, say). > > How the file is created is irrelevant so long as it has the data that > you want to extract within it. > > -- > Alan G > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > > > > > > ------------------------------ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > > End of Tutor Digest, Vol 101, Issue 11 > ************************************** > -- *We have enough for our need but not enough for our greed.*
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor