From admin.dslcomputer at gmail.com Wed Jul 8 19:42:18 2015 From: admin.dslcomputer at gmail.com (admin.dslcomputer at gmail.com) Date: Wed, 8 Jul 2015 17:42:18 +0000 Subject: [Soc2015-general] =?utf-8?q?Maximum_to_the_Minimum?= Message-ID: <559d618a.03a1440a.4222.ffff8459@mx.google.com> Hi Everyone: How do I rewrite the python script, below, to get a printout from the Maximum to the Minimum, and to convert a string into a number? largest = None smallest = None while True: num = raw_input("Enter a number") if num == "done" : break print num try: inp=raw_input("enter a number:") num = float(inp) except: print "Invalid Input" continue if smallest is None: smallest = value elif value < smallest: smallest = value elif largest is None: largest = value elif value > largest: largest = value print "Maximum is", largest print "Minimum is", smallest Regards, Hal -------------- next part -------------- An HTML attachment was scrubbed... URL: From admin.dslcomputer at gmail.com Thu Jul 9 00:54:46 2015 From: admin.dslcomputer at gmail.com (admin.dslcomputer at gmail.com) Date: Wed, 8 Jul 2015 22:54:46 +0000 Subject: [Soc2015-general] =?utf-8?q?Fw=3A_=E2=80=98Maximum_is_None_and_th?= =?utf-8?b?ZSDigJhNaW5pbXVtIGlzIE5vbmXigJk=?= In-Reply-To: <559da4f6.2a80460a.43eb.ffff9d69@mx.google.com> References: <559da4f6.2a80460a.43eb.ffff9d69@mx.google.com> Message-ID: <559daa51.435e460a.6e4b.ffffa65f@mx.google.com> Hi Everyone: When the user enters a series of number integers, the output reads: ?Maximum is None and the ?Minimum is None? What is the source of the syntax Error, below: largest = None smallest = None while True: num = raw_input("Enter a number: ") if (num == "done") : break try: value = float(num) except ValueError: print "Invalid input" continue if smallest is None: smallest = value elif value < smallest: smallest = value print smallest, value if largest is None: largest = value elif value > largest: largest = value print largest, largest print "Maximum is", largest print "Minimum is", smallest Regards, Hal Sent from Surface -------------- next part -------------- An HTML attachment was scrubbed... URL: From Stefan.Richthofer at gmx.de Thu Jul 9 03:38:54 2015 From: Stefan.Richthofer at gmx.de (Stefan Richthofer) Date: Thu, 9 Jul 2015 03:38:54 +0200 Subject: [Soc2015-general] =?utf-8?q?Fw=3A_=E2=80=98Maximum_is_None_and_th?= =?utf-8?b?ZSDigJhNaW5pbXVtIGlzIE5vbmXigJk=?= In-Reply-To: <559daa51.435e460a.6e4b.ffffa65f@mx.google.com> References: <559da4f6.2a80460a.43eb.ffff9d69@mx.google.com>, <559daa51.435e460a.6e4b.ffffa65f@mx.google.com> Message-ID: An HTML attachment was scrubbed... URL: From admin.dslcomputer at gmail.com Tue Jul 21 20:24:51 2015 From: admin.dslcomputer at gmail.com (admin.dslcomputer at gmail.com) Date: Tue, 21 Jul 2015 18:24:51 +0000 Subject: [Soc2015-general] =?utf-8?q?String_Error_Message?= Message-ID: <55ae8f94.2558460a.6358.ffffdd79@mx.google.com> Hi Everyone: I'm trying to write a python program that prompts for a file name, then opens that file and reads through the file, looking for lines of the form: X-DSPAM-Confidence: 0.8475 The program is designed to Count these lines and extract the floating point values from each of the lines and compute the average of those values and produce an output as shown below. However, line 10 displays the following string syntax error: SyntaxError: invalid syntax (, line 10) The raw URL link to the code is available at http://tinyurl.com/oa7cppq You can download the sample data at http://www.pythonlearn.com/code/mbox-short.txt Regards, Hal Sent from Surface -------------- next part -------------- An HTML attachment was scrubbed... URL: From admin.dslcomputer at gmail.com Wed Jul 22 02:12:40 2015 From: admin.dslcomputer at gmail.com (admin.dslcomputer at gmail.com) Date: Wed, 22 Jul 2015 00:12:40 +0000 Subject: [Soc2015-general] =?utf-8?q?String_Utility_Question?= Message-ID: <55aee035.edb8420a.2c953.4620@mx.google.com> Hi Everyone: Where can I find documentation on "line.split()" The Python online documentation site contains no available search term for "line.split()",i.e., URL link at https://www.python.org/downloads/release/python-279/ Moreover, the Python Library Reference refers to the utility function as an ArgumentParser: "def convert_arg_line_to_args(self, arg_line): return arg_line.split()", i.e., The Python Library Reference, Release 2.7.10; 15.4. argparse ? Parser for command-line options, arguments and sub-commands p. 475. Likewise, the Python Tutorial refers to the utility function as a Generator Expressions: "unique_words = set(word for line in page for word in line.split())?,i.e., Python Tutorial, Release 2.7.10; 9.11. Generator Expressions p. 75 Regards, Hal Sent from Surface -------------- next part -------------- An HTML attachment was scrubbed... URL: From asmeurer at gmail.com Wed Jul 22 03:40:24 2015 From: asmeurer at gmail.com (Aaron Meurer) Date: Tue, 21 Jul 2015 20:40:24 -0500 Subject: [Soc2015-general] String Utility Question In-Reply-To: <55aee035.edb8420a.2c953.4620@mx.google.com> References: <55aee035.edb8420a.2c953.4620@mx.google.com> Message-ID: This is not an appropriate list for these kinds of questions. This list is for discussions about Google Summer of Code. You should direct your questions to the tutor list https://mail.python.org/mailman/listinfo/tutor. Aaron Meurer On Tue, Jul 21, 2015 at 7:12 PM, wrote: > Hi Everyone: > > Where can I find documentation on "line.split()" > > The Python online documentation site contains no available search term for > "line.split()",i.e., URL link at > https://www.python.org/downloads/release/python-279/ > > Moreover, the Python Library Reference refers to the utility function as > an ArgumentParser: "def convert_arg_line_to_args(self, arg_line): return > arg_line.split()", i.e., The Python Library Reference, Release 2.7.10; > 15.4. argparse ? Parser for command-line options, arguments and > sub-commands p. 475. > > Likewise, the Python Tutorial refers to the utility function as a > Generator Expressions: "unique_words = set(word for line in page for word > in line.split())?,i.e., Python Tutorial, Release 2.7.10; 9.11. Generator > Expressions p. 75 > > Regards, > Hal > > Sent from Surface > > > _______________________________________________ > Soc2015-general mailing list > Soc2015-general at python.org > https://mail.python.org/mailman/listinfo/soc2015-general > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ltc.hotspot at gmail.com Tue Jul 28 22:15:50 2015 From: ltc.hotspot at gmail.com (ltc.hotspot at gmail.com) Date: Tue, 28 Jul 2015 20:15:50 +0000 Subject: [Soc2015-general] =?utf-8?q?line_error_on_no=2E_7?= Message-ID: <55b7e350.2f83460a.bbf2.3147@mx.google.com> Hi Everyone, I'm writing python code to read a data text file, split the file into a list of words using the split(function) and to print the results in alphabetical order. The raw python code is located at http://tinyurl.com/oua9uqx The sample data is located at http://tinyurl.com/odt9nhe Desired Output: ['Arise', 'But', 'It', 'Juliet', 'Who', 'already', 'and', 'breaks', 'east', 'envious', 'fair', 'grief', 'is', 'kill', 'light', 'moon', 'pale', 'sick', 'soft', 'sun', 'the', 'through', 'what', 'window', 'with', 'yonder'] There is a line error on no. 7 What is the cause of this error? Regards, Hal Sent from Surface -------------- next part -------------- An HTML attachment was scrubbed... URL: From ltc.hotspot at gmail.com Tue Jul 28 22:15:50 2015 From: ltc.hotspot at gmail.com (ltc.hotspot at gmail.com) Date: Tue, 28 Jul 2015 20:15:50 +0000 Subject: [Soc2015-general] =?utf-8?q?line_error_on_no=2E_7?= Message-ID: <55b7e37e.6222460a.e39a3.ffff9f67@mx.google.com> Hi Everyone, I'm writing python code to read a data text file, split the file into a list of words using the split(function) and to print the results in alphabetical order. The raw python code is located at http://tinyurl.com/oua9uqx The sample data is located at http://tinyurl.com/odt9nhe Desired Output: ['Arise', 'But', 'It', 'Juliet', 'Who', 'already', 'and', 'breaks', 'east', 'envious', 'fair', 'grief', 'is', 'kill', 'light', 'moon', 'pale', 'sick', 'soft', 'sun', 'the', 'through', 'what', 'window', 'with', 'yonder'] There is a line error on no. 7 What is the cause of this error? Regards, Hal Sent from Surface -------------- next part -------------- An HTML attachment was scrubbed... URL: From admin.dslcomputer at gmail.com Wed Jul 29 01:27:42 2015 From: admin.dslcomputer at gmail.com (admin.dslcomputer at gmail.com) Date: Tue, 28 Jul 2015 23:27:42 +0000 Subject: [Soc2015-general] =?utf-8?q?String_Attribute?= Message-ID: <55b81030.275c460a.69283.417e@mx.google.com> Hi Everyone: What is the source of the syntax error to the String Attribute? Go to the following URL links and view a copy of the raw data file code and sample data: 1.) http://tinyurl.com/p2xxxhl 2.) http://tinyurl.com/nclg6pq Here is the desired output: stephen.marquard at uct.ac.za louis at media.berkeley.edu .... Hal Sent from Surface -------------- next part -------------- An HTML attachment was scrubbed... URL: From info at securitylabs.in Wed Jul 29 04:42:12 2015 From: info at securitylabs.in (harsh daftary) Date: Wed, 29 Jul 2015 08:12:12 +0530 Subject: [Soc2015-general] line error on no. 7 In-Reply-To: <55b7e350.2f83460a.bbf2.3147@mx.google.com> References: <55b7e350.2f83460a.bbf2.3147@mx.google.com> Message-ID: First of all .append is a function, So you need to pass what data you need to append. On line 7 It should be like : list.append(line) Secondly this is not the correct place to ask questions related to such matter. This is mailing list for Summer of code 2015. Searching for solution on google is more easy. Best regards, Harsh Daftary Please consider the environment before printing. On 29 Jul 2015 01:47, wrote: > Hi Everyone, > > I'm writing python code to read a data text file, split the file into a > list of words using the split(function) and to print the results in > alphabetical order. > > The raw python code is located at http://tinyurl.com/oua9uqx > > The sample data is located at > http://tinyurl.com/odt9nhe > > > Desired Output: ['Arise', 'But', 'It', 'Juliet', 'Who', 'already', 'and', > 'breaks', 'east', 'envious', 'fair', 'grief', 'is', 'kill', 'light', > 'moon', 'pale', 'sick', 'soft', 'sun', 'the', 'through', 'what', 'window', > 'with', 'yonder'] > > There is a line error on no. 7 > What is the cause of this error? > > > Regards, > Hal > > Sent from Surface > > > _______________________________________________ > Soc2015-general mailing list > Soc2015-general at python.org > https://mail.python.org/mailman/listinfo/soc2015-general > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ltc.hotspot at gmail.com Wed Jul 29 06:40:15 2015 From: ltc.hotspot at gmail.com (ltc.hotspot at gmail.com) Date: Wed, 29 Jul 2015 04:40:15 +0000 Subject: [Soc2015-general] =?utf-8?q?MBox_Message_Error?= Message-ID: <55b859f6.6a32460a.3fc2.ffff8328@mx.google.com> Hi Everyone, The data file source, yields an output display: "1" Not the design output as follows: "stephen.marquard at uct.ac.za louis at media.berkeley.edu zqian at umich.edu" How do I remove the syntax error in the code? URL link is available at http://tinyurl.com/nrkwtjb The Data file is available at http://tinyurl.com/n9dhelw Regards, Hal Sent from Surface -------------- next part -------------- An HTML attachment was scrubbed... URL: From ltc.hotspot at gmail.com Thu Jul 30 00:20:16 2015 From: ltc.hotspot at gmail.com (ltc.hotspot at gmail.com) Date: Wed, 29 Jul 2015 22:20:16 +0000 Subject: [Soc2015-general] =?utf-8?q?Mailbox?= In-Reply-To: <55b94c40.e201460a.c7eec.3d3a@mx.google.com> References: <1438127743513.656239125@boxbe> <55b9270a.2558460a.9efb4.2a02@mx.google.com> <55b92da0.aaf5420a.ff2b1.2128@mx.google.com>, , <55b9386d.6a65420a.1866.275d@mx.google.com>, <55b94c40.e201460a.c7eec.3d3a@mx.google.com> Message-ID: <55b951c9.ea7c420a.7e143.3f08@mx.google.com> Hi Everyone: I have a second and unrelated question: I tried to work backward to see if there is a logic error associated with a variable is being skipped over: #top of code, initialize variable output_list = ["default"] #rest of code If you get at the end print output_list ['default'] Raw Data File: count = 0 fname = raw_input("Enter file name: ") if len(fname) < 1 : fname = "mbox-short.txt" for line in fname: line = line.strip() if not line.startswith('From '): continue line = line.split() count = count + 1 print len(line) fh = open(fname) print "There were", count, "lines in the file with From as the first word" Sample data file at http://www.pythonlearn.com/code/mbox-short.txt Desired Output: stephen.marquard at uct.ac.za louis at media.berkeley.edu zqian at umich.edu rjlowe at iupui.edu zqian at umich.edu rjlowe at iupui.edu Thanks, Hal Sent from Surface From: Phu Sam Sent: ?Wednesday?, ?July? ?29?, ?2015 ?1?:?06? ?PM To: Ltc Hotspot _______________________________________________ Baypiggies mailing list Baypiggies at python.org To change your subscription options or unsubscribe: https://mail.python.org/mailman/listinfo/baypiggies -------------- next part -------------- An HTML attachment was scrubbed... URL: From himanshu2014iit at gmail.com Thu Jul 30 04:27:09 2015 From: himanshu2014iit at gmail.com (Himanshu Mishra) Date: Thu, 30 Jul 2015 07:57:09 +0530 Subject: [Soc2015-general] Mailbox In-Reply-To: <55b951c9.ea7c420a.7e143.3f08@mx.google.com> References: <1438127743513.656239125@boxbe> <55b9270a.2558460a.9efb4.2a02@mx.google.com> <55b92da0.aaf5420a.ff2b1.2128@mx.google.com> <55b9386d.6a65420a.1866.275d@mx.google.com> <55b94c40.e201460a.c7eec.3d3a@mx.google.com> <55b951c9.ea7c420a.7e143.3f08@mx.google.com> Message-ID: Please do not inflate the list again and again after it has been suggested to you that it is not the correct place to do python home works. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ltc.hotspot at gmail.com Fri Jul 31 03:05:03 2015 From: ltc.hotspot at gmail.com (ltc.hotspot at gmail.com) Date: Fri, 31 Jul 2015 01:05:03 +0000 Subject: [Soc2015-general] =?utf-8?q?duplicate_line_output?= Message-ID: <55baca28.0365420a.5038.ffffbba9@mx.google.com> Hi Everyone, Question: How do I remove each duplicate line output? Here is the raw data code: fname = raw_input("Enter file name: ") if len(fname) < 1 : fname = "mbox-short.txt" fh = open(fname) count = 0 for line in fh: if not line.startswith('From'): continue line2 = line.strip() line3 = line2.split() line4 = line3[1] print line4 count = count + 1 print "There were", count, "lines in the file with From as the first word" The problem is in the output results: Python 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 16:44:52) [MSC v.1500 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information. IPython 3.2.0 -- An enhanced Interactive Python. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://anaconda.org ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: cd C:\Users\vm\Desktop\apps\docs\Python C:\Users\vm\Desktop\apps\docs\Python In [2]: %run _8_5_v_7.py Enter file name: mbox-short.txt stephen.marquard at uct.ac.za stephen.marquard at uct.ac.za louis at media.berkeley.edu louis at media.berkeley.edu zqian at umich.edu zqian at umich.edu rjlowe at iupui.edu rjlowe at iupui.edu zqian at umich.edu zqian at umich.edu rjlowe at iupui.edu rjlowe at iupui.edu cwen at iupui.edu cwen at iupui.edu cwen at iupui.edu cwen at iupui.edu gsilver at umich.edu gsilver at umich.edu gsilver at umich.edu gsilver at umich.edu zqian at umich.edu zqian at umich.edu gsilver at umich.edu gsilver at umich.edu wagnermr at iupui.edu wagnermr at iupui.edu zqian at umich.edu zqian at umich.edu antranig at caret.cam.ac.uk antranig at caret.cam.ac.uk gopal.ramasammycook at gmail.com gopal.ramasammycook at gmail.com david.horwitz at uct.ac.za david.horwitz at uct.ac.za david.horwitz at uct.ac.za david.horwitz at uct.ac.za david.horwitz at uct.ac.za david.horwitz at uct.ac.za david.horwitz at uct.ac.za david.horwitz at uct.ac.za stephen.marquard at uct.ac.za stephen.marquard at uct.ac.za louis at media.berkeley.edu louis at media.berkeley.edu louis at media.berkeley.edu louis at media.berkeley.edu ray at media.berkeley.edu ray at media.berkeley.edu cwen at iupui.edu cwen at iupui.edu cwen at iupui.edu cwen at iupui.edu cwen at iupui.edu cwen at iupui.edu There were 54 lines in the file with From as the first word In [3]: Regards, Hal Sent from Surface Sent from Surface Sent from Surface -------------- next part -------------- An HTML attachment was scrubbed... URL: