Re: [Tutor] Need help with python
On 15/09/15 00:25, Laura Creighton wrote: The gmane.org reference is here: gmane.comp.python.testing.general I am not getting anything sensible out of this. Works for me, but admittedly I only see one post in September. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python
In a message of Mon, 14 Sep 2015 19:48:01 +0100, Alan Gauld writes: >On 14/09/15 18:02, vijayram wrote: >> Hi, >> >> I need help with python nose tests and test-suite… can I request help >> with a tutor.. > >You can try asking basic questions here, but as nose is not >part of the standard library you might get more help on the >python testing list: > >The gmane.org reference is here: > >gmane.comp.python.testing.general I am not getting anything sensible out of this. But the testing list is over here: http://lists.idyll.org/pipermail/testing-in-python/ Though it has been unbelievably quiet this month ... Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python
On Mon, Sep 14, 2015 at 10:02:35AM -0700, vijayram wrote: > Hi, > > I need help with python nose tests and test-suite… can I request help with > a tutor.. Sure. Ask your questions on the mailing list, and somebody will answer. This is a group for *public* tutoring, so that everyone can learn from it, not private tutoring. -- Steve ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Need help with python
Hi, I need help with python nose tests and test-suite… can I request help with a tutor.. Thank you, vijay ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python
On 14/09/15 18:02, vijayram wrote: Hi, I need help with python nose tests and test-suite… can I request help with a tutor.. You can try asking basic questions here, but as nose is not part of the standard library you might get more help on the python testing list: The gmane.org reference is here: gmane.comp.python.testing.general -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python script
Sorry, I missed copying this to the list. On Aug 4, 2014 8:13 AM, P McCombs mcco...@imperium.org wrote: On Jul 31, 2014 4:50 PM, McKinley, Brett D. bmckin...@mawss.com wrote: I would like to see if someone can help me with a python script. I’m trying to export a file geodatabase feature class to csv file. This is what I have so far: Does the code you attached execute successfully? Are you running this as a tool, or from the command line? Be cautioned that arcpy is outside the scope of this mailing list, but it won't have much to do with your questions at first. import arcpy import os import csv import domainvalues def export_to_csv(dataset, output, dialect): Output the data to a CSV file # create the output writer out_writer = csv.writer(open(output, 'wb'), dialect=dialect) # return the list of field names and field values header, rows = domainvalues.header_and_iterator(dataset) # write the field names and values to the csv file out_writer.writerow(map(domainvalues._encodeHeader, header)) for row in rows: out_writer.writerow(map(domainvalues._encode, row)) if __name__ == __main__: # Get parameters dataset_name = arcpy.GetParameterAsText(0) output_file = arcpy.GetParameterAsText(1) delim = arcpy.GetParameterAsText(2).lower() dialect = 'excel' if delim == 'comma': pass else: dialect = 'excel-tab' try: export_to_csv(dataset_name, output_file, dialect) except Exception as err: arcpy.AddError('Error: {0}'.format(err)) I would like for the script to export only certain fields and also export only the newest records. As for now, it’s exporting everything. It is best to try to add one new feature on your own and attach the result. You will get the best feedback that way. Thanks Brett McKinley ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python script
On Mon, Aug 4, 2014 at 11:20 AM, P McCombs mcco...@imperium.org wrote: Sorry, I missed copying this to the list. On Aug 4, 2014 8:13 AM, P McCombs mcco...@imperium.org wrote: On Jul 31, 2014 4:50 PM, McKinley, Brett D. bmckin...@mawss.com wrote: I would like to see if someone can help me with a python script. I’m trying to export a file geodatabase feature class to csv file. This is what I have so far: Does the code you attached execute successfully? Are you running this as a tool, or from the command line? Be cautioned that arcpy is outside the scope of this mailing list, but it won't have much to do with your questions at first. import arcpy import os import csv import domainvalues def export_to_csv(dataset, output, dialect): Output the data to a CSV file # create the output writer out_writer = csv.writer(open(output, 'wb'), dialect=dialect) # return the list of field names and field values header, rows = domainvalues.header_and_iterator(dataset) # write the field names and values to the csv file out_writer.writerow(map(domainvalues._encodeHeader, header)) for row in rows: before you write row, you need to examine the appropriate fields to filter out the fields you don't want, and order the rows by whichever field determines newness. Also, you probably want to output your header row to only include columns you wish to write out_writer.writerow(map(domainvalues._encode, row)) if __name__ == __main__: # Get parameters dataset_name = arcpy.GetParameterAsText(0) output_file = arcpy.GetParameterAsText(1) delim = arcpy.GetParameterAsText(2).lower() dialect = 'excel' if delim == 'comma': pass else: dialect = 'excel-tab' try: export_to_csv(dataset_name, output_file, dialect) except Exception as err: arcpy.AddError('Error: {0}'.format(err)) I would like for the script to export only certain fields and also export only the newest records. As for now, it’s exporting everything. It is best to try to add one new feature on your own and attach the result. You will get the best feedback that way. Thanks Brett McKinley ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor -- Joel Goldstick http://joelgoldstick.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Need help with python script
I would like to see if someone can help me with a python script. I'm trying to export a file geodatabase feature class to csv file. This is what I have so far: import arcpy import os import csv import domainvalues def export_to_csv(dataset, output, dialect): Output the data to a CSV file # create the output writer out_writer = csv.writer(open(output, 'wb'), dialect=dialect) # return the list of field names and field values header, rows = domainvalues.header_and_iterator(dataset) # write the field names and values to the csv file out_writer.writerow(map(domainvalues._encodeHeader, header)) for row in rows: out_writer.writerow(map(domainvalues._encode, row)) if __name__ == __main__: # Get parameters dataset_name = arcpy.GetParameterAsText(0) output_file = arcpy.GetParameterAsText(1) delim = arcpy.GetParameterAsText(2).lower() dialect = 'excel' if delim == 'comma': pass else: dialect = 'excel-tab' try: export_to_csv(dataset_name, output_file, dialect) except Exception as err: arcpy.AddError('Error: {0}'.format(err)) I would like for the script to export only certain fields and also export only the newest records. As for now, it's exporting everything. Thanks Brett McKinley ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help on Python API programmig
Hi Sourav, Please use Reply all when you reply an email so that everyone else also gets your messages and your chances of getting better help increases. On Sat, Nov 16, 2013 at 3:35 PM, Sourav Biswas sob...@gmail.com wrote: Hi Amit, Yes I know, the question is not quite good. Currently I am trying to learn web API programming with Python. The ultimate goal is work with OpenStack API. Can you please let me know, how to start on this. Thanks for the reply and thanks in advance. Sorry, I certainly didn't mean that your question was not good. Now that you have mentioned what specifically you are looking to learn, it becomes slightly easier to make some suggestions. I don't have any personal experience with OpenStack API. However, looking at [1], it seems like you will be mostly dealing with making HTTP requests and reading responses. There are couple of standard library modules such as urlllib2 and httplib that may be useful to you. However, in this case, you would certainly benefit from directly learning to use Requests [2]. Note that however, you will need to be familiar with Python data structures such as dictionaries and know how to work with JSON data ( please see the 'json' standard module). [1] http://docs.openstack.org/api/quick-start/content/ [2]http://www.python-requests.org/en/latest/ I am hoping those prove helpful. All the best, Amit. -- http://echorand.me ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Need help on Python API programmig
Hi All, This is my first post. I want to learn API programming with Python. I have basic knowledge of Python Programming. Could you please let me know the starting points for this programming. -- Thanks, Sourav Biswas Hyderabad ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help on Python API programmig
Hello Sourav, On 16/11/2013 6:53 AM, Sourav Biswas sob...@gmail.com wrote: Hi All, This is my first post. I want to learn API programming with Python. I have basic knowledge of Python Programming. Could you please let me know the starting points for this programming. Since your question is fairly vague, could you please describe what you are trying to learn? An API is an interface. It can be an operating system interface, a vehicle web API or simply a web API. Some more details will be a lot of help. Best, Amit. -- Thanks, Sourav Biswas Hyderabad ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python keyboard press/navigation commands
On Mon, Mar 11, 2013 at 8:59 PM, akuma ukpo johnnyu...@gmail.com wrote: This is the problem Implement a function called get_direction which, on a particular character , gives the direction corresponding to that character. Do you know how to write a test case for this function? You had test cases for one of the previous problems you sent the list earlier. Can you do the same thing for this problem? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python keyboard press/navigation commands
On 12/03/13 03:59, akuma ukpo wrote: I have tried def get_direction(self): whenever a key is pressed the character moves to the direction corresponding to the key 'North':w 'South': s 'East' : d 'West' : a What did you think that would do? There is no control structure and no return value. Nothing is assigned to anything. And none of the names are defined anywhere. It makes no sense to me looking at it and it certainly doesn't make sense to Python trying to execute it. If you want to respond to keys you are going to have to either pass in the keystroke to the function or read the keystroke inside the function. How you do that depends on whether you are using a GUI, and if so which. Whether you are using PyGame. Or if a CLI program which OS you are using. Finally, from a user experience point of view, it might be more logical to make the keys w,a,s,z North, West,East and South respectively since its a more logical correspondence to the compass points (assuming a standard QWERTY keyboard layout). -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python keyboard press/navigation commands
Finally, from a user experience point of view, it might be more logical to make the keys w,a,s,z North, West,East and South respectively since its a more logical correspondence to the compass points (assuming a standard QWERTY keyboard layout). Most games use WASD, so user experience would be in favour of it compared to WASZ. There are a couple of reasons for this: if you're moving forward you're not moving backward, and if you're moving backward you're not moving forward, so the finger you use for W can be used for S. So finger position is W(S) A and D; three fingers that can handle moving at an angle (NW, NE by keys WA or WD, SW and SE by keys SA or SD) or in one direction. Compare with WASZ, moving NW is still WA, but NE would be WS, which are keys that are very close together. Moving backwards (south) would be even worse. Finally, WASD has the same layout as the arrow keys, but is located elsewhere on the keyboard (so you can map other keys to other functions in the games; your pinky is close to both shift and ctrl, thumb to space and C, E, R, F, V and Q, and 1-5 are all within close range -- compare to the arrow keys, where you get four keys (shift, ctrl, 1 and 0) nearby). Some people like to use the number keys (8456 for WASD) instead, as they too are relatively close to more keys, but overall I think that WASD is the standard. At least that's what I suspect. -- best regards, Robert S. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python keyboard press/navigation commands
Finally, from a user experience point of view, it might be more logical to make the keys w,a,s,z North, West,East and South respectively Most games use WASD, so user experience would be in favour of it compared to WASZ. There are a couple of reasons for this: You live and learn! :-) You can probably also deduce that I'm more of a touch typist than I am a gamer... or does solitaire count? Moving backwards (south) would be even worse. Finally, WASD has the same layout as the arrow keys, Arrow keys? What are they? hjkl in vim and C-n,C-p,C-f,C-b in emacs Thanks for the education. Alan G___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Need help with python keyboard press/navigation commands
This is the problem Implement a function called get_direction which, on a particular character , gives the direction corresponding to that character. The correspondences are as follows: The character ’w’ corresponds to the direction ’North’ The character ’a’ corresponds to the direction ’West’ The character ’s’ corresponds to the direction ’South’ The character ’d’ corresponds to the direction ’East’ I am having difficulty coming up with a function and testing it as well. I have tried def get_direction(self): whenever a key is pressed the character moves to the direction corresponding to the key 'North':w 'South': s 'East' : d 'West' : a but it didn't work...please help. -- *Akuma* ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] need help with python for counter
On 12/19/2012 12:40 AM, Brandon Merritt wrote: I feel silly, but I'm having the darndest time trying to figure out why this for counter won't work. I know that there is the count method for the string class, but I was just trying to do it the syntactical way to prove myself that I know the very basics. As of right now, my script is just returning 1 or 0, even if I very clearly make sure that I specify at least 4 instances of the digit in my number string: number = raw_input('Enter a 7-unit number: ') digit = raw_input('Enter a single digit: ') for i in number: count = 0 if i == digit: count += 1 else: count = 0 print count Two separate problems in that code, either of which would be enough to ruin the count value. 1) Your code sets the count to zero INSIDE the loop, so every time through, you trash whatever earlier value you had. This assures that only the last loop matters! You ought to be zeroing the counter just once, before the loop starts. 2) In your else clause, as soon as you encounter some other character, the code is zeroing the counter. count = 0 for i in number: if i == digit: count += 1 While I've got your attention, let me point out that nowhere in your description do you actually tell us what values you're entering, and what values you expect. You ought to supply sample values which illustrate the problem. The above code is really only a guess, as to what you wanted. But the notion of doing the initialization OUTSIDE the loop is an important one, and I'm sure that part is correct. -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] need help with python for counter
On 19/12/12 05:40, Brandon Merritt wrote: the string class, but I was just trying to do it the syntactical way to prove myself that I know the very basics. Which is not a bad thing. just returning 1 or 0, even if I very clearly make sure that I specify at least 4 instances of the digit in my number string: number = raw_input('Enter a 7-unit number: ') digit = raw_input('Enter a single digit: ') for i in number: count = 0 you reset count to zero everytime round the loop. You need to move this outside the loop. HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] need help with python for counter
On 12/19/2012 12:40 AM, Brandon Merritt wrote: I feel silly, but I'm having the darndest time trying to figure out why this for counter won't work. I know that there is the count method for the string class, but I was just trying to do it the syntactical way to prove myself that I know the very basics. As of right now, my script is just returning 1 or 0, even if I very clearly make sure that I specify at least 4 instances of the digit in my number string: number = raw_input('Enter a 7-unit number: ') digit = raw_input('Enter a single digit: ') for i in number: count = 0 if i == digit: count += 1 Drop next two statements and try agan else: count = 0 print count -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] need help with python for counter
I feel silly, but I'm having the darndest time trying to figure out why this for counter won't work. I know that there is the count method for the string class, but I was just trying to do it the syntactical way to prove myself that I know the very basics. As of right now, my script is just returning 1 or 0, even if I very clearly make sure that I specify at least 4 instances of the digit in my number string: number = raw_input('Enter a 7-unit number: ') digit = raw_input('Enter a single digit: ') for i in number: count = 0 if i == digit: count += 1 else: count = 0 print count Thanks, Brandon -- *Brandon Merritt** (707) 481-1744* * * ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] need help with python for counter
On 12/19/2012 12:40 AM, Brandon Merritt wrote: I feel silly, but I'm having the darndest time trying to figure out why this for counter won't work. I know that there is the count method for the string class, but I was just trying to do it the syntactical way to prove myself that I know the very basics. As of right now, my script is just returning 1 or 0, even if I very clearly make sure that I specify at least 4 instances of the digit in my number string: number = raw_input('Enter a 7-unit number: ') digit = raw_input('Enter a single digit: ') for i in number: count = 0 if i == digit: count += 1 else: count = 0 Why do you have the else: clause? You can also do: count = sum(i==digit for i in number) I think this is very clear and short.. -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] need help with python for counter
After incrementing for a little while, if the condition i == digit is not met for the current character, count is reset by the else: branch. Your count variable must feel frustrated like a dog which keeps being yanked back by a cord of length 0 when it tries to get free. Trung Doan == On Wed, Dec 19, 2012 at 4:40 PM, Brandon Merritt merrit...@gmail.comwrote: I feel silly, but I'm having the darndest time trying to figure out why this for counter won't work. I know that there is the count method for the string class, but I was just trying to do it the syntactical way to prove myself that I know the very basics. As of right now, my script is just returning 1 or 0, even if I very clearly make sure that I specify at least 4 instances of the digit in my number string: number = raw_input('Enter a 7-unit number: ') digit = raw_input('Enter a single digit: ') for i in number: count = 0 if i == digit: count += 1 else: count = 0 print count Thanks, Brandon -- *Brandon Merritt** (707) 481-1744* * * ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] need help with python for counter
On 19/12/12 5:12 PM, Mitya Sirenef wrote: You can also do: count = sum(i==digit for i in number) I think this is very clear and short.. Another... import re count = len(re.findall(digit, number)) -- shantanoo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Need help, tutoring Python
I am looking for someone who knows WordPress to spend an hour with me on the phone and with a shared screen to coach me on how WordPress can be configured using Python files. Can you refer me? Thanks, NM ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] need help in python
hi I am a student and i need soe help regarding my assignmentif some one can help me il be glad. i wil be waiting for the reply thanks Date: Thu, 21 Jan 2010 12:33:40 -0500 From: samueldechampl...@gmail.com To: tutor@python.org Subject: [Tutor] Hello This is my first message to this mailing list. I want to create a project with glade and pygtk on fedora. Can you suggest a good IDE? _ Hotmail: Trusted email with powerful SPAM protection. http://clk.atdmt.com/GBL/go/196390707/direct/01/___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] need help in python
Am Donnerstag, 21. Januar 2010 18:48:36 schrieb invincible patriot: hi I am a student and i need soe help regarding my assignmentif some one can help me il be glad. You do realize that assignments are things to be done by yourself? This is a mailing list, so just post your questions, but do not expect us to do the assignment for you. OTOH specific questions, that suggest that you've at least tried to solve the problem yourself, will probably be answered. (Consider that answering and explaining it to you will probably take more time than just creating the your assignment, but that's beside the point.) Andreas i wil be waiting for the reply thanks Date: Thu, 21 Jan 2010 12:33:40 -0500 From: samueldechampl...@gmail.com To: tutor@python.org Subject: [Tutor] Hello This is my first message to this mailing list. I want to create a project with glade and pygtk on fedora. Can you suggest a good IDE? _ Hotmail: Trusted email with powerful SPAM protection. http://clk.atdmt.com/GBL/go/196390707/direct/01/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] need help in python
Don't post messages to the list in reply to other messages, it messes up threading. Other than that, you'll have to tell us more about your assignment if you want help. -Luke On Thu, Jan 21, 2010 at 11:48 AM, invincible patriot invincible_patr...@hotmail.com wrote: hi I am a student and i need soe help regarding my assignmentif some one can help me il be glad. i wil be waiting for the reply thanks -- Date: Thu, 21 Jan 2010 12:33:40 -0500 From: samueldechampl...@gmail.com To: tutor@python.org Subject: [Tutor] Hello This is my first message to this mailing list. I want to create a project with glade and pygtk on fedora. Can you suggest a good IDE? -- Hotmail: Trusted email with powerful SPAM protection. Sign up now.http://clk.atdmt.com/GBL/go/196390707/direct/01/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] need help in python
And your question is ? On Thu, Jan 21, 2010 at 12:48 PM, invincible patriot invincible_patr...@hotmail.com wrote: hi I am a student and i need soe help regarding my assignmentif some one can help me il be glad. i wil be waiting for the reply thanks ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python game program
Luke Paireepinart wrote: Please don't reply to messages like this. If you are starting a new thread, send a new e-mail to tutor@python.org mailto:tutor@python.org. DO NOT start a thread by replying to another message. If you do, it will bork on people's machines who use threaded e-mail readers. also, please remove long, irrelevant quotations from your e-mails unless you reference it. for example, the quoted text in your e-mail is at least 10x longer than the actual content. I believe mark already answered your question. Thanks, -Luke On Tue, Jun 30, 2009 at 7:38 PM, jonathan wallis mindboggle...@gmail.com mailto:mindboggle...@gmail.com wrote: My problem is simple, is their a way to make a variable equal multiple numbers? Such as X = 5 through 10, and then the program makes x equal something random 5 through 10, or something similar. And most importantly, don't top-post. Because it messes up reading order. Why is top-posting harmful? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Need help with python game program
My problem is simple, is their a way to make a variable equal multiple numbers? Such as X = 5 through 10, and then the program makes x equal something random 5 through 10, or something similar. 2009/6/30 tutor-requ...@python.org 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. PYTHONPATH-corrected (Bob Rea) 2. Re: Needing Help (Bob Rea) 3. Re: PYTHONPATH-corrected (Steve Willoughby) 4. Re: Needing Help (Wayne) 5. Re: Needing Help (Bob Rea) 6. Re: Needing Help (Marc Tompkins) -- Message: 1 Date: Tue, 30 Jun 2009 14:33:27 -0400 From: Bob Rea pet...@petard.us To: tutor@python.org Subject: [Tutor] PYTHONPATH-corrected Message-ID: 200906301433.27455.pet...@petard.us Content-Type: text/plain; charset=iso-8859-1 In working my way through the book on python, I am working in directories for chapers. Now I am on modules, and some are reused in later chapters. I have set up a directory for the modules. How do I add it to my PYTHONPATH? I can use sys.path.append but that only lasts for the session. This is on a suse linux 10 box -- Bob Rea mailto:pet...@petard.us http://www.petard.us http://www.petard.us/blog http://www.petard.us/gallery -- Message: 2 Date: Tue, 30 Jun 2009 14:06:01 -0400 From: Bob Rea b...@telaugos.com To: tutor@python.org Subject: Re: [Tutor] Needing Help Message-ID: 200906301406.02104@telaugos.com Content-Type: text/plain; charset=utf-8 On Tue June 30 2009 1:17 pm, vishwajeet singh dextrou...@gmail.comwrote: You can put your script in pastebin http://python.pastebin.com/ http://python.pastebin.com/I don't think any one will mind you pasting code in mail but pastebin makes it easier to read I am making my way through _Making Use of Python_ by Rashi Gupta. I am using Python 2.4.1 I have run into problems in a script, listed at http://python.pastebin.com/m51bc3388 If I input my own name and dob, it works: b...@gandalf:~/python/MakingUse/Chapter05 python code1.py Enter your first name: Bob Enter your last name: Rea Enter your date of birth, mm-dd-: 03-05-1943 You can chose one of the following login names: 1. BobR 2. BobR53 3. RBob43 4. BRea66 If I use the data listed in the book, it fails: b...@gandalf:~/python/MakingUse/Chapter05 python code1.py Enter your first name: Laura Enter your last name: Jones Enter your date of birth, mm-dd-: 12-24-1980 You can chose one of the following login names: 1. LauraJ 2. LauraJ2412 3. JLaura80 Traceback (most recent call last): File code1.py, line 67, in ? fourth=fname[0]+lname+ age_func() TypeError: cannot concatenate 'str' and 'NoneType' objects What is going on here? Bob Rea pet...@petard.us -- Bob Rea mailto:gapet...@stsams.org http://www.petard.us http://www.petard.us/blog http://www.petard.us/gallery Where is Bill Stringfellow now that we really need him? -- Message: 3 Date: Tue, 30 Jun 2009 12:08:13 -0700 From: Steve Willoughby st...@alchemy.com To: Bob Rea pet...@petard.us Cc: tutor@python.org Subject: Re: [Tutor] PYTHONPATH-corrected Message-ID: 20090630190813.ga65...@dragon.alchemy.com Content-Type: text/plain; charset=us-ascii On Tue, Jun 30, 2009 at 02:33:27PM -0400, Bob Rea wrote: In working my way through the book on python, I am working in directories for chapers. Now I am on modules, and some are reused in later chapters. I have set up a directory for the modules. How do I add it to my PYTHONPATH? I can use sys.path.append but that only lasts for the session. You set the variable in your system's environment, which is platform-dependent. For Linux, you'd typically put a line in your ~/.profile or ~/.cshrc or ~/.login or ~/.bashrc or whatever your shell uses per your account set up. So, for example, in a bash/sh shell, you'd say: export PYTHONPATH=/path/to/my/modules or for csh: setenv PYTHONPATH /path/to/my/modules Then starting the next time you log in, that will be set in your environment for you. This is on a suse linux 10 box -- Bob Rea mailto:pet...@petard.us http://www.petard.us http://www.petard.us/blog http://www.petard.us/gallery ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Steve Willoughby| Using billion-dollar satellites st...@alchemy.com | to hunt for Tupperware.
Re: [Tutor] Need help with python game program
jonathan wallis mindboggle...@gmail.com wrote in message news:57b8984c0906301738w1fb0e660m6bb2123399f27...@mail.gmail.com... My problem is simple, is their a way to make a variable equal multiple numbers? Such as X = 5 through 10, and then the program makes x equal something random 5 through 10, or something similar. Use the random module. There are various types of random number generation there, such as: x = random.randint(5,10) -Mark ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python game program
Please don't reply to messages like this. If you are starting a new thread, send a new e-mail to tu...@python.org. DO NOT start a thread by replying to another message. If you do, it will bork on people's machines who use threaded e-mail readers. also, please remove long, irrelevant quotations from your e-mails unless you reference it. for example, the quoted text in your e-mail is at least 10x longer than the actual content.I believe mark already answered your question. Thanks, -Luke On Tue, Jun 30, 2009 at 7:38 PM, jonathan wallis mindboggle...@gmail.comwrote: My problem is simple, is their a way to make a variable equal multiple numbers? Such as X = 5 through 10, and then the program makes x equal something random 5 through 10, or something similar. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Need help with python game program
jonathan wallis wrote: My problem is simple, is their a way to make a variable equal multiple numbers? Such as X = 5 through 10, and then the program makes x equal something random 5 through 10, or something similar. much snipping For a short question, why did you quote an entire mailing list digest? Answer to your question, certainly a variable can equal multiple numbers. Several ways: 1) one at a time. X=5, then later X=7.332 2) a list of values X = [5.3, 8.001, 17, 2] 3) a dictionaryX = {tom:3, dick:42, harry:12} 4) a class. Sky's the limit here As for random, look up the random.uniform() and random.randint() functions. Did you have a particular programming language in mind? I've been assuming Python, but you might be thinking something else. Have you any experience in any other language? DaveA ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor