Re: [Tutor] Problem with Saved File

2019-04-06 Thread Alan Gauld via Tutor
On 05/04/2019 19:59, Stephen P. Molnar wrote: > I am using Spyder v-3.3.3 on Debian Stretch and have written a script to > process data from another application. I am having a problem saving the > resulting file [A] as a column vector. > > The vector is saved by np.savetxt(name_s,[A]). > > Wh

Re: [Tutor] Problem using termcolor and colorama

2018-11-15 Thread Peter Otten
John Blower wrote: > I try to create colour text by using these two modules , only returns the > colour code, no colour text. How to solve this problem. > import termcolor import colorama colorama.init() termcolor.cprint('Hello World','red') > [31mHello World[0m Start with o

Re: [Tutor] Problem using termcolor and colorama

2018-11-15 Thread Steven D'Aprano
On Thu, Nov 15, 2018 at 01:18:16PM +, John Blower wrote: > I try to create colour text by using these two modules , only returns the > colour code, no colour text. > How to solve this problem. Use a terminal that supports colour codes. > >>> import termcolor > >>> import colorama > >>> co

Re: [Tutor] Problem using termcolor and colorama

2018-11-15 Thread David Rock
> On Nov 15, 2018, at 07:18, John Blower wrote: > > I try to create colour text by using these two modules , only returns the > colour code, no colour text. > How to solve this problem. > import termcolor import colorama colorama.init() termcolor.cprint('Hello World','red'

Re: [Tutor] Problem with task, please help!

2018-10-28 Thread Alan Gauld via Tutor
On 27/10/2018 20:41, michiel nijs wrote: > I am an engineering student and we have to use Python. > We don't have lessons so we all have to learn it on our own. What, no lessons at all?! Or just no lessons on Python? Have you done any kind of programming before? > We got a task and I am stuck o

Re: [Tutor] problem with creating paths

2018-10-17 Thread Mark Lawrence
On 17/10/18 18:18, Mats Wichmann wrote: On 10/17/2018 10:07 AM, Shall, Sydney via Tutor wrote: Firstly, I would like to thank Steven for reminding me of the assert statement. I should have remembered this. It allowed me to isolate the problem, which predictably (for me) was very elementary. I am

Re: [Tutor] problem with creating paths

2018-10-17 Thread Shall, Sydney via Tutor
On 17/10/2018 18:18, Mats Wichmann wrote: On 10/17/2018 10:07 AM, Shall, Sydney via Tutor wrote: Firstly, I would like to thank Steven for reminding me of the assert statement. I should have remembered this. It allowed me to isolate the problem, which predictably (for me) was very elementary. I

Re: [Tutor] problem with creating paths

2018-10-17 Thread Mats Wichmann
On 10/17/2018 10:07 AM, Shall, Sydney via Tutor wrote: > Firstly, I would like to thank Steven for reminding me of the assert > statement. I should have remembered this. It allowed me to isolate the > problem, which predictably (for me) was very elementary. I am too > embarrassed to say how simple

Re: [Tutor] problem with creating paths

2018-10-17 Thread Shall, Sydney via Tutor
Firstly, I would like to thank Steven for reminding me of the assert statement. I should have remembered this. It allowed me to isolate the problem, which predictably (for me) was very elementary. I am too embarrassed to say how simple the error was. However, my original problem was not solved

Re: [Tutor] problem with creating paths

2018-10-17 Thread Peter Otten
Shall, Sydney via Tutor wrote: > There are two items that are 'wrong' in this output. > > 1. The property 'paths' is defined in the program as a list and the > items are added using paths.append(), yet the test says that when tested > it is a tuple. >>> paths = ["foo", "bar"], >>> paths += "baz"

Re: [Tutor] problem with creating paths

2018-10-17 Thread Steven D'Aprano
On Wed, Oct 17, 2018 at 03:18:00PM +0100, Shall, Sydney via Tutor wrote: [...] > After searching I have found this unexpected output illustrated in the > copy-paste below. > > > test > > > The type of the paths is: Believe Python when it tells you something is a tuple. Trust me, it

Re: [Tutor] Problem compiling code from GitHub

2018-09-02 Thread Dave Hill
I now have 'odswriter' working, thank you. I, eventually, uninstalled all versions of python and cleaned out as many references to python and odswriter as I could find. I then installed 3.7, and odswriter using $ cd odswriter $ python setup.py install I guess that the first attempt a

Re: [Tutor] Problem compiling code from GitHub

2018-08-29 Thread Oscar Benjamin
On Mon, 27 Aug 2018 at 13:18, Dave Hill wrote: > > I have found 'odswriter' on GitHub > https://github.com/mmulqueen/odswriter which appears to provide what I > want. However, I have come to a halt, due to the limitation of my knowledge. > > I admit that I am confounded as to where/how to access t

Re: [Tutor] Problem compiling code from GitHub

2018-08-29 Thread Peter Otten
Dave Hill wrote: > I did as suggested but with the same result. Make sure that your script is *not* in the same directory as ODSWriter.py and that the directory containing ODSWriter is *not* in sys.path. Then try again. ___ Tutor maillist - Tutor

Re: [Tutor] Problem compiling code from GitHub

2018-08-28 Thread Dave Hill
I did as suggested but with the same result. I am now looking at extracting the code from the the separate files to form a single module, and hopefully get a result. On 27/08/2018 14:14, Steven D'Aprano wrote: Hi Dave, and welcome! On Mon, Aug 27, 2018 at 12:14:33PM +0100, Dave Hill wrote:

Re: [Tutor] Problem compiling code from GitHub

2018-08-27 Thread Mats Wichmann
On 08/27/2018 05:14 AM, Dave Hill wrote: > I get the following error > >    Traceback (most recent call last): >       File "C:\Code\Python\ODS_Writer\Test_ODS#1.py", line 5, in >         from OdsWriter import odswriter as ods >       File "C:\Code\Python\ODS_Writer\OdsWriter.py", line 7, in >

Re: [Tutor] Problem compiling code from GitHub

2018-08-27 Thread Steven D'Aprano
Hi Dave, and welcome! On Mon, Aug 27, 2018 at 12:14:33PM +0100, Dave Hill wrote: > I have found 'odswriter' on GitHub > https://github.com/mmulqueen/odswriter which appears to provide what I > want. However, I have come to a halt, due to the limitation of my knowledge. [...] > I get the fol

Re: [Tutor] Problem importing pandas library

2018-05-27 Thread Mats Wichmann
On 05/27/2018 01:18 AM, Alan Gauld via Tutor wrote: > On 27/05/18 04:43, Bhavna Soni wrote: >> I installed pandas library using pip9. I get errors while importing >> it, Uninstalling and Re-installing won't help. It says DLL load failed >> as window file is not found. The next time I import it says

Re: [Tutor] Problem importing pandas library

2018-05-27 Thread Alan Gauld via Tutor
On 27/05/18 04:43, Bhavna Soni wrote: > I installed pandas library using pip9. I get errors while importing > it, Uninstalling and Re-installing won't help. It says DLL load failed > as window file is not found. The next time I import it says pandas > don't have core attribute, ut core folder is pr

Re: [Tutor] Problem regarding NZEC error

2018-04-08 Thread Alan Gauld via Tutor
On 08/04/18 06:16, SUNIL KUMAR MAURYA wrote: > NZEC error occurs often in Python 3.5. How can it be resolved? A Non Zero Error Code occurs when the interpreter exits with an error. Those are very rarely errors in the interpreter they are due to errors in the code which it is executing. So, to sto

Re: [Tutor] Problem with testing - container

2018-03-29 Thread Albert-Jan Roskam
Op 29 mrt. 2018 21:06 schreef "Shall, Sydney" : > > I have a problem with a specific test, I think. > > I use a Mac with OS X 10.13.3 > I use Anaconda with Python 3.5 > > I have been writing tests for a Class that I have written. I am not > finished yet, but there are already nearly 400 tests. The

Re: [Tutor] Problem in python online class

2017-12-23 Thread Albert-Jan Roskam
On Dec 21, 2017 09:58, Tim Cordsen via Tutor wrote: > > Hello everybody, > I am doing a python online class and I am lost. The "teacher" is a little > chaotic and doesn't provide his code, so everyone must type on their own. > > Now the class reached a point where I am lost. It is about doing a s

Re: [Tutor] Problem in python online class

2017-12-21 Thread Alan Gauld via Tutor
On 21/12/17 08:40, Tim Cordsen via Tutor wrote: > ...doesn't provide his code, so everyone must type on their own. Thats not necessarily a bad thing. You only really learn when you type in your own code. Its like muscle memory for the brain and fingers. > web frontend with a form and saving the

Re: [Tutor] Problem python script

2017-12-19 Thread William Ray Wing
Sent from my iPhone > On Dec 19, 2017, at 3:47 AM, Antoan Hristov wrote: > > Hello, > > I am using a script which extracts data from internet every Monday, but > sometimes I have a problem that the script is not finishing properly. In > terminal I stop it with Ctrl-C and the message it gives

Re: [Tutor] Problem python script

2017-12-19 Thread Alan Gauld via Tutor
On 19/12/17 09:47, Antoan Hristov wrote: > I am using a script which extracts data from internet every Monday, but > sometimes I have a problem that the script is not finishing properly. In > terminal I stop it with Ctrl-C and the message it gives me is: It is very hard to comment on code which y

Re: [Tutor] Problem with 'IF' condition

2017-12-04 Thread Alan Gauld via Tutor
s are same". > But it doesnot. >   > Please let me know if you find any errors. >   > Best Regards, > Achyut Ajmera  >   >   > > - Original Message - > Subject: Re: [Tutor] Problem with 'IF' condition > From: "Alan

Re: [Tutor] Problem with 'IF' condition

2017-12-01 Thread Steven D'Aprano
On Fri, Dec 01, 2017 at 07:02:47AM -0700, a.ajm...@incycleautomation.com wrote: > I copied my program as plain text below, Unfortunately you didn't, as the text you quote below will not run as Python code due to indentation errors. So you have (accidentally, I trust) messed up the indentation.

Re: [Tutor] Problem with 'IF' condition

2017-12-01 Thread Peter Otten
a.ajm...@incycleautomation.com wrote: > I am trying to compare two different values using "IF" condition in my > program. Everything is working fine except this. I copied my program as > plain text below Your code has indentation errors, my analysis assumes # the following was added to make it r

Re: [Tutor] Problem with 'IF' condition

2017-12-01 Thread Alan Gauld via Tutor
On 01/12/17 14:02, a.ajm...@incycleautomation.com wrote: > - If you see in my code, I'm writing to "test1.txt" and saving that value in > "nao" as well. > On the other side, I'm reading from "test3.txt" and saving that value in > "abb" just like above. > > Now, my goal is to compare these two

Re: [Tutor] problem with a sub-class

2017-12-01 Thread Sydney Shall
On 30/11/2017 22:08, Alan Gauld via Tutor wrote: On 30/11/17 15:37, Shall, Sydney wrote: My problem is with constructing a sub-class. My sub-class is constructed as follows: import Population_ProductivityV24 as POCWP Note that POCWP is an alias for the *module* Population_ProductivityV24. I

Re: [Tutor] problem with a sub-class

2017-12-01 Thread Peter Otten
Alan Gauld via Tutor wrote: > On 30/11/17 15:37, Shall, Sydney wrote: > >> My problem is with constructing a sub-class. >> >> My sub-class is constructed as follows: >> >> import Population_ProductivityV24 as POCWP > > Note that POCWP is an alias for the *module* Population_ProductivityV24. >

Re: [Tutor] problem with a sub-class

2017-11-30 Thread Alan Gauld via Tutor
On 30/11/17 15:37, Shall, Sydney wrote: > My problem is with constructing a sub-class. > > My sub-class is constructed as follows: > > import Population_ProductivityV24 as POCWP Note that POCWP is an alias for the *module* Population_ProductivityV24. It is not a class. > line 27 : class Simula

Re: [Tutor] problem with program in python in easy steps

2017-10-26 Thread boB Stepp
On Thu, Oct 26, 2017 at 3:02 PM, Chris Coleman wrote: > > i wrote these programs and saved them per instructions on page 128 and 129 > in the book "python in easy steps". > > class Person: > '''A base class to define Person properties.''' > def__init__(self,name): The above line should ge

Re: [Tutor] problem with program in python in easy steps

2017-10-26 Thread Alan Gauld via Tutor
On 26/10/17 21:02, Chris Coleman wrote: > i wrote these programs and saved them per instructions on page 128 and 129 > in the book "python in easy steps". I don't know the book but... > > class Person: > '''A base class to define Person properties.''' > def__init__(self,name): > s

Re: [Tutor] problem with program

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 18:53, Alan Gauld via Tutor wrote: > On 13/10/17 13:04, Chris Coleman wrote: > >> def_init_(self,chat): > >> File "scripts/bird.py", line 4 >> def_init_(self,chat): >> ^ >> SyntaxError: invalid syntax > > There are two problems here. I meant to

Re: [Tutor] problem with program

2017-10-13 Thread Mark Lawrence via Tutor
On 13/10/17 13:04, Chris Coleman wrote: just learning python as my first programming language. going through the book "python in easy steps" by mike mcgrath. i am going through the programs in chapter 7 and can't get them to work. here is the first one in the chapter: class Bird: '''A bas

Re: [Tutor] problem with program

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 13:04, Chris Coleman wrote: > def_init_(self,chat): > File "scripts/bird.py", line 4 > def_init_(self,chat): > ^ > SyntaxError: invalid syntax There are two problems here. The first is that you need a space after the def. The second is that ther

Re: [Tutor] problem with python3.5 headfirst python 2nd ed chpt 10 test drive example decorator issues

2017-09-29 Thread Rajesh Balel
Hi I don't see any session initializer , please try with that session = web.session.Session(app,store,initializer={'login': 0,'privilege': 0,'username':'Guest','logged_in':False}) Regards Rajesh On Thu, Sep 28, 2017 at 3:35 PM, peter wrote: > I am on chapter 10 of headfirst python second editi

Re: [Tutor] problem with python3.5 headfirst python 2nd ed chpt 10 test drive example decorator issues

2017-09-29 Thread Alan Gauld via Tutor
On 28/09/17 23:35, peter wrote: > I am on chapter 10 of headfirst python second edition. got most of the > prior codes to work but am stuck on this one. I don;t know the book and only vaguely know Flask, but I'd start by adding some debug print statements to the functions. Something like def ..

Re: [Tutor] problem with python3.5 headfirst python 2nd ed chpt 10 test drive example decorator issues

2017-09-29 Thread Peter Otten
peter wrote: > I am on chapter 10 of headfirst python second edition. got most of the > prior codes to work but am stuck on this one. I will add the > simple_webapp.py which is a decorator enabled and checker.py which is > the decorator. when I go into 127.0.0.1:5000 and enter I get the correct >

Re: [Tutor] Problem with if statements and else statements

2017-05-30 Thread Cameron Simpson
On 30May2017 12:06, Peter Otten <__pete...@web.de> wrote: Cameron Simpson wrote: As written it should be a bit slower: to construct a set each member get tested for presence. The cost is in making the set, not in searching it. No, CPython is a bit smarter than that: dis.dis('if m in {"1", "J

Re: [Tutor] Problem with if statements and else statements

2017-05-30 Thread Peter Otten
Cameron Simpson wrote: > On 29May2017 01:17, Alan Gauld wrote: >>On 29/05/17 00:12, Alex Kleider wrote: >>> Would >> if Month in {'January', '1'}: >>> >>> be even better? (regarding efficiency perhaps? Trivial point, I know, >>> but just wondering.) >> >>If in doubt try it out and profile/ti

Re: [Tutor] Problem with if statements and else statements

2017-05-29 Thread Alex Kleider
On 2017-05-29 16:08, Cameron Simpson wrote: snip BTW, in Python we tend to use named like "Fred" for classes (or factories), and "fred" for regular variables. And "FRED" for things that would be constants in other languages. Eg: MAX_THINGS = 16 class Foo: def FooBah(x): return

Re: [Tutor] Problem with if statements and else statements

2017-05-29 Thread Cameron Simpson
On 29May2017 01:17, Alan Gauld wrote: On 29/05/17 00:12, Alex Kleider wrote: Would if Month in {'January', '1'}: be even better? (regarding efficiency perhaps? Trivial point, I know, but just wondering.) If in doubt try it out and profile/time it. But I don't think it will make much diff

Re: [Tutor] Problem with if statements and else statements

2017-05-28 Thread Peter Otten
Alex Kleider wrote: > On 2017-05-28 13:13, Mats Wichmann wrote: > >> FWIW, if checking for multiples, you could also write: >> >> if Month in ['January', '1']: > > Would > if Month in {'January', '1'}: > > be even better? (regarding efficiency perhaps? Trivial point, I know, > but just

Re: [Tutor] Problem with if statements and else statements

2017-05-28 Thread Alan Gauld via Tutor
On 29/05/17 00:12, Alex Kleider wrote: > On 2017-05-28 13:13, Mats Wichmann wrote: > >> FWIW, if checking for multiples, you could also write: >> >> if Month in ['January', '1']: > > Would > if Month in {'January', '1'}: > > be even better? (regarding efficiency perhaps? Trivial point, I

Re: [Tutor] Problem with if statements and else statements

2017-05-28 Thread Alex Kleider
On 2017-05-28 13:13, Mats Wichmann wrote: FWIW, if checking for multiples, you could also write: if Month in ['January', '1']: Would if Month in {'January', '1'}: be even better? (regarding efficiency perhaps? Trivial point, I know, but just wondering.)

Re: [Tutor] Problem with if statements and else statements

2017-05-28 Thread Mats Wichmann
On 05/27/2017 06:14 PM, boB Stepp wrote: > Hello Jalen! > > On Sat, May 27, 2017 at 4:19 PM, Jalen Barr wrote: >> >> In this code it always changes the PlaceHolder to 0 no matter what Month is >> set to >> >> Month ="September" >> >> if Month == "January" or "1": >> PlaceHolder = 0 > > This

Re: [Tutor] Problem with if statements and else statements

2017-05-27 Thread boB Stepp
Hello Jalen! On Sat, May 27, 2017 at 4:19 PM, Jalen Barr wrote: > > In this code it always changes the PlaceHolder to 0 no matter what Month is > set to > > Month ="September" > > if Month == "January" or "1": > PlaceHolder = 0 This must be written as: if Month == "January" or Month == "1":

Re: [Tutor] Problem with if statements and else statements

2017-05-27 Thread Jalen Barr
I am in Python version 3.6.1 On Sat, May 27, 2017 at 4:19 PM, Jalen Barr wrote: > In this code it always changes the PlaceHolder to 0 no matter what Month > is set to > > Month ="September" > > if Month == "January" or "1": > PlaceHolder = 0 > else: > print("Information Error") > print(P

Re: [Tutor] Problem on parsing data

2017-03-13 Thread David Rock
> On Mar 13, 2017, at 16:19, jarod_v6--- via Tutor wrote: > > > What can I do for parse better that file and Have only the comma outside the > string ? > I recommend using the cvs module rather than try to write your own. https://docs.python.org/2/library/csv.html — David Rock da...@gran

Re: [Tutor] Problem with Spyder IDE in Anaconda3

2017-02-27 Thread Alan Gauld via Tutor
On 27/02/17 20:52, Stephen P. Molnar wrote: > To the best of my knowledge I am not running any anti-virus software. > This has always been a Linux computer and there has been no need. There are threats to Linux just fewer of them, plus you could be used as a host to pass on damaged files so you

Re: [Tutor] Problem with Spyder IDE in Anaconda3

2017-02-27 Thread Stephen P. Molnar
On 02/27/2017 02:29 PM, Marc Tompkins wrote: On Mon, Feb 27, 2017 at 10:46 AM, Stephen P. Molnar mailto:s.mol...@sbcglobal.net>> wrote: I had sent the following message to Anaconda Support: I have just installed anaconda3-4.3.0 and upgraded Spyder to v-3.1.3. When I open Spyder and

Re: [Tutor] Problem with Spyder IDE in Anaconda3

2017-02-27 Thread Marc Tompkins
On Mon, Feb 27, 2017 at 12:52 PM, Stephen P. Molnar wrote: > On 02/27/2017 02:29 PM, Marc Tompkins wrote: > >> On Mon, Feb 27, 2017 at 10:46 AM, Stephen P. Molnar >> mailto:s.mol...@sbcglobal.net>> wrote: >> >> I had sent the following message to Anaconda Support: >> >> I have just instal

Re: [Tutor] Problem with Spyder IDE in Anaconda3

2017-02-27 Thread Marc Tompkins
On Mon, Feb 27, 2017 at 10:46 AM, Stephen P. Molnar wrote: > I had sent the following message to Anaconda Support: > > I have just installed anaconda3-4.3.0 and upgraded Spyder to v-3.1.3. > > When I open Spyder and run a python script that has run perfectly in a > previous version of Spyder I g

Re: [Tutor] problem with scroll in Tkinter

2017-01-13 Thread Peter Otten
Ali Moradi wrote: > https://paste.pound-python.org/show/CIKA8eOFbdq18r3nFUBv/ > > On Fri, Jan 13, 2017 at 10:25 AM, Ali Moradi > wrote: > >> hi. I've written this code and i can't fix the scrollbar error. i am a >> beginner in Python plz help. this is python3 code. According to http://infohos

Re: [Tutor] problem with scroll in Tkinter

2017-01-13 Thread Alan Gauld via Tutor
On 13/01/17 06:55, Ali Moradi wrote: > https://paste.pound-python.org/show/CIKA8eOFbdq18r3nFUBv/ > > On Fri, Jan 13, 2017 at 10:25 AM, Ali Moradi wrote: > >> hi. I've written this code and i can't fix the scrollbar error. i am a >> beginner in Python plz help. this is python3 code. You've poste

Re: [Tutor] problem with scroll in Tkinter

2017-01-13 Thread Ali Moradi
https://paste.pound-python.org/show/CIKA8eOFbdq18r3nFUBv/ On Fri, Jan 13, 2017 at 10:25 AM, Ali Moradi wrote: > hi. I've written this code and i can't fix the scrollbar error. i am a > beginner in Python plz help. this is python3 code. > ___ Tutor mail

Re: [Tutor] Problem

2016-08-29 Thread D . V . N . Sarma డి . వి . ఎన్ . శర్మ
The following code should do. for a in range(1,10): for b in range(1,5): for c in range(1,5): for mc in range(50, 55): if mc ==(6*a)+(9*b)+(20*c): print "mc= ",mc,"a= ",a,"b= ",b,"c=",c regards, Sarma. On Mon, Aug 29, 2016 at 3:34 PM, A

Re: [Tutor] Problem

2016-08-29 Thread Alan Gauld via Tutor
On 28/08/16 23:53, shahan khan wrote: I changed the code a bit and this is the result: for a in range(1,11): for b in range(1,6): for c in range(1,6): mc=(6*a)+(9*b)+(20*c) if mc==50: print 'For 50 McNuggets:''a=',a,'b=',b,'c=',c if mc==51: print 'Fpr 51 McNuggets:''a=',a,'b=',b,'c=',c if mc==52:

Re: [Tutor] Problem

2016-08-29 Thread zakaria
The " {} " is the place holder of the values of a, b and c argument passed to format. this example maybe can help to understand print('I like the python {}'.format('mailing-list')) will output >>>  I like the python mailing-list The format methode will substitute the {} with the argument it takes

Re: [Tutor] Problem

2016-08-29 Thread zakaria
if you print the values of a, b ,c that satisfy and don't satisfy the condiction cm == 50 at the same time, you can't know what works and what did not work. here is the code that i wrote and worked well for a in range(1, 11):         # i replaced 10 by 11 to include the 10      for b in range(1,

Re: [Tutor] Problem

2016-08-29 Thread Shahan Khan
I understand your argument. You're saying M(50),M(51)and M(52) is basically a set of 6 9 and 20 packs and we should approach it by using lower values starting from 0 for one or two variables to simply the solution on paper. I think I have some idea now as to how to approach this problem. Sent f

Re: [Tutor] Problem

2016-08-29 Thread khalil zakaria Zemmoura
Can you please rewrite the python code using proper indentation, since, as you know, indentation matters in Python Le 28 août 2016 18:40, "shahan khan" a écrit : Hello I'm teching myself Python using MIT opencourse ware. I'm a beginner and have some what knowledge of c and c++. I'm using Python

Re: [Tutor] Problem

2016-08-29 Thread shahan khan
Yes i format my code but i can't figure out this new problem On Mon, Aug 29, 2016 at 3:20 AM, Joel Goldstick wrote: > On Sun, Aug 28, 2016 at 10:46 AM, shahan khan > wrote: > > Hello > > I'm teching myself Python using MIT opencourse ware. I'm a beginner and > > have some what knowledge of c an

Re: [Tutor] Problem

2016-08-29 Thread shahan khan
I changed the code a bit and this is the result: for a in range(1,11): for b in range(1,6): for c in range(1,6): mc=(6*a)+(9*b)+(20*c) if mc==50: print 'For 50 McNuggets:''a=',a,'b=',b,'c=',c if mc==51: print 'Fpr 51 McNuggets:''a=',a,'b=',b,'c=',c if mc==52: print 'For 52 McNuggets:''a=',a,'b=',b,

Re: [Tutor] Problem

2016-08-29 Thread Shahan Khan
Thankyou so much for taking the time it really means alot. I'll change the code and try again. I have just one question what purpose does " {} " serve here? Sent from my iPhone > On 29-Aug-2016, at 2:30 AM, zakaria wrote: > > if you print the values of a, b ,c that satisfy and don't satisfy th

Re: [Tutor] Problem

2016-08-28 Thread Danny Yoo
On Sun, Aug 28, 2016 at 7:46 AM, shahan khan wrote: > Hello > I'm teching myself Python using MIT opencourse ware. I'm a beginner and > have some what knowledge of c and c++. I'm using Python version > Here is my code: [code cut] Before showing code, try to express what you're trying to do in

Re: [Tutor] Problem

2016-08-28 Thread Alan Gauld via Tutor
On 28/08/16 15:46, shahan khan wrote: Theorem: If it is possible to buy x, x+1,…, x+5 sets of McNuggets, for some x, then it is possible to buy any number of McNuggets >= x, given that McNuggets come in 6, 9 and 20 packs. Here is my code: for a in range(1,10): for b in range(1,5): for c in ra

Re: [Tutor] Problem

2016-08-28 Thread Joel Goldstick
On Sun, Aug 28, 2016 at 10:46 AM, shahan khan wrote: > Hello > I'm teching myself Python using MIT opencourse ware. I'm a beginner and > have some what knowledge of c and c++. I'm using Python version > > Here is the problem: > McDiophantine: Selling McNuggets > In mathematics, a Diophantine equat

Re: [Tutor] Problem with graphics.py

2016-08-10 Thread Alan Gauld via Tutor
On 09/08/16 17:55, Michael Selik wrote: > Do you mind running the following commands from the python shell? > > py> import os > py> os.getcwd() > '/Users/mike' > py> sorted(os.listdir('.')) > ['.Trash', 'Applications', 'Desktop', ...] > > This will show us what location your python interpreter h

Re: [Tutor] Problem with graphics.py

2016-08-09 Thread Michael Selik
On Tue, Aug 9, 2016 at 12:51 PM Cyrus Parvereshi wrote: > Hi! I'm starting out with programming by self-studying python with a > textbook used at my university. I came to a chapter that introduced object > oriented programming with graphics tools like GraphWin and Point. However, > even though I

Re: [Tutor] Problem with graphics.py

2016-08-09 Thread Steven D'Aprano
On Tue, Aug 09, 2016 at 09:43:26AM -0700, Cyrus Parvereshi wrote: > Hi! I'm starting out with programming by self-studying python with a > textbook used at my university. I came to a chapter that introduced object > oriented programming with graphics tools like GraphWin and Point. However, > even t

Re: [Tutor] Problem with code interating thri a list

2016-08-03 Thread Peter Otten
Chris Clifton via Tutor wrote: > I have been practicing with strings. Splitting them, joining them, > changing case. All has been going well but came across a exercise in one > of the code practice sites that has you changing the case of different > characters in a string. Anything in upper cas

Re: [Tutor] Problem with code interating thri a list

2016-08-02 Thread Alan Gauld via Tutor
On 03/08/16 00:30, Alan Gauld via Tutor wrote: >> if item == item.lower(): I meant to add that the string islower() method is probably more readable: if item.islower() Also that you could use a list comprehension to do this without converting to a list initially: def conveert(text):

Re: [Tutor] Problem with code interating thri a list

2016-08-02 Thread Danny Yoo
On Tue, Aug 2, 2016 at 7:59 AM, Chris Clifton via Tutor wrote: > My Logic: Since a string is immutable, I converted it to a list to separate > out the characters and keep them in order. Idea is to change the case of the > characters in the list then run a join to convert it back to a string.

Re: [Tutor] Problem with code interating thri a list

2016-08-02 Thread Alan Gauld via Tutor
On 02/08/16 15:59, Chris Clifton via Tutor wrote: > My Logic: Since a string is immutable, I converted it to a list That is certainly one approach but your solution has some snags. In fact its probably not necessary unless you want to play with big strings. You could just build a new string from

Re: [Tutor] Problem with code

2016-07-05 Thread Alan Gauld via Tutor
On 05/07/16 04:36, Frank Lawrence wrote: > Hello, I have a code here that I’m having a problem with. Unfortunately we can't see it. Now, I could see it among a bunch of HTML when I checked it in the moderator queue, so I'm guessing you sent it as some kind of attachment and the server has stripp

Re: [Tutor] Problem on handling if statement

2015-11-25 Thread Laura Creighton
In a message of Wed, 25 Nov 2015 17:28:24 +0800, Crusier writes: >Dear All, > >I am trying to do some web scraping. Attached below is my code: > > >from bs4 import BeautifulSoup >import requests > >#string = str(0175, 0005, 1177) >url = "https://www.etnet.com.hk/www/eng/stocks/realtime/quote.php?co

Re: [Tutor] problem with code

2015-09-01 Thread Alan Gauld
On 01/09/15 14:07, Nathan Clark wrote: I have written another basic program out of python, please could you instruct me on how to fix it question= input("What is your question) print("Let me think about that") time.sleep(10) #10 seconds wait print (question) print ("lol")

Re: [Tutor] problem with code

2015-09-01 Thread Steven D'Aprano
On Tue, Sep 01, 2015 at 02:07:51PM +0100, Nathan Clark wrote: > I have written another basic program out of python, please could you > instruct me on how to fix it I assume you are using Python 3, is that correct? > question= input("What is your question) > print("Let me think about that")

Re: [Tutor] problem with code

2015-09-01 Thread Nathan Clark
I have written another basic program out of python, please could you instruct me on how to fix it question= input("What is your question) print("Let me think about that") time.sleep(10) #10 seconds wait print (question) print ("lol") On Thu, Aug 20, 2015 at 4:08 PM, Job wrote:

Re: [Tutor] Problem using lxml

2015-08-23 Thread Stefan Behnel
Anthony Papillion schrieb am 23.08.2015 um 01:16: > from lxml import html > import requests > > page = requests.get("http://joplin.craigslist.org/search/w4m";) > tree = html.fromstring(page.text) While requests has its merits, this can be simplified to tree = html.parse("http://joplin.craigs

Re: [Tutor] Problem using lxml

2015-08-22 Thread Anthony Papillion
Many thanks, Martin! I had indeed skipped creating the tree object and a few other things you pointed out. Here is my finished simple code that actually works: from lxml import html import requests page = requests.get("http://joplin.craigslist.org/search/w4m";) tree = html.fromstring(page.text) t

Re: [Tutor] Problem using lxml

2015-08-22 Thread Martin A. Brown
Hi there Anthony, I'm pretty new to lxml but I pretty much thought I'd understood the basics. However, for some reason, my first attempt at using it is failing miserably. Here's the deal: I'm parsing specific page on Craigslist ( http://joplin.craigslist.org/search/rea) and trying to retrei

Re: [Tutor] Problem using lxml

2015-08-22 Thread Joel Goldstick
On Sat, Aug 22, 2015 at 5:05 PM, Anthony Papillion wrote: > Hello Everyone, > > I'm pretty new to lxml but I pretty much thought I'd understood the basics. > However, for some reason, my first attempt at using it is failing miserably. > > Here's the deal: > > I'm parsing specific page on Craigslis

Re: [Tutor] problem with code

2015-08-21 Thread Mark Lawrence
On 20/08/2015 15:49, Aravind Jaya wrote: time = input("How long on average do you spend on the computer per day?") if time <= 2: print "Message1" else: print "Message2" If you insist on top posting you could at least get your response correct. The comparison will fail in Python 3.3

Re: [Tutor] problem with code

2015-08-21 Thread Timo
Op 20-08-15 om 16:49 schreef Aravind Jaya: time = input("How long on average do you spend on the computer per day?") if time <= 2: print "Message1" else: print "Message2" This will raise 2 errors: - time will be a string. So time <= 2 is invalid. - print is a function. Updated co

Re: [Tutor] problem with code (Alan Gauld)

2015-08-20 Thread Joel Goldstick
On Thu, Aug 20, 2015 at 2:12 PM, Freddy wrote: > Hello, > > I am trying to make Hangman. But main part of the game i.e. comparing user > input with secret word is not working properly. > > Can you have a look where am I going wrong? > > > Thank you > > Attachment: Python code file. > No attachment

Re: [Tutor] problem with code

2015-08-20 Thread Alan Gauld
On 20/08/15 18:07, Alan Gauld wrote: (print("that seems reasonable")) if time<=2 else print ("get a life") There is an alternative way of writing what you want but it's not very commonly used: print("that seems reasonable" if time <=2 else "get a life") I just realized that the OP's versi

Re: [Tutor] problem with code

2015-08-20 Thread Aravind Jaya
time = input("How long on average do you spend on the computer per day?") if time <= 2: print "Message1" else: print "Message2" On Thu, Aug 20, 2015 at 3:20 PM, Nathan Clark <26110...@gmail.com> wrote: > I have written a basic program out of python and it is not functioning, > please c

Re: [Tutor] problem with code

2015-08-20 Thread Alan Gauld
On 20/08/15 10:50, Nathan Clark wrote: I have written a basic program out of python and it is not functioning, please could you proof read my code and tell me how to fix it.It is in python 3.3 time=int(input("How long on average do you spend on the computer per day?") (print("that seems reasonab

Re: [Tutor] problem with code

2015-08-20 Thread Emile van Sebille
On 8/20/2015 2:50 AM, Nathan Clark wrote: I have written a basic program out of python and it is not functioning, please could you proof read my code and tell me how to fix it.It is in python 3.3 time=int(input("How long on average do you spend on the computer per day?") (print("that seems reaso

Re: [Tutor] Problem on select esecution of object in a class

2015-08-05 Thread Peter Otten
jarod_v6--- via Tutor wrote: > I have a class with many objects and I want to select using opt parse > some function id = options.step > ena = Rnaseq(options.configura, options.rst, options.outdir) > now = datetime.datetime.now() > ena.show() > diz = {} > f

Re: [Tutor] Problem on select esecution of object in a class

2015-08-05 Thread Alan Gauld
On 05/08/15 17:04, jarod_v6--- via Tutor wrote: for i in "ena."+"".join(diz[id])+"()": print i.command Here you are creating a string and then iterating over the string one character at a time. But the characters do not have a command attribute. > 3

Re: [Tutor] Problem in packages

2015-07-01 Thread Flynn, Stephen (L & P - IT)
> Python version 2.7.10. > I have problem in installing .whl format packages. > what version of setuptools is required for .whl format packages. > I have installed Setuptools version 0.6.0 and upgraded pip to 7.0.3. > wndows 7 powershell 1. > I tried installing setuptools 18.0 but it is also in .wh

Re: [Tutor] Problem in packages

2015-07-01 Thread Oscar Benjamin
On 1 July 2015 at 07:11, megha garg wrote: > Python version 2.7.10. > I have problem in installing .whl format packages. > what version of setuptools is required for .whl format packages. > I have installed Setuptools version 0.6.0 and upgraded pip to 7.0.3. > wndows 7 powershell 1. > I tried inst

Re: [Tutor] Problem on filtering data

2015-06-08 Thread Steven D'Aprano
On Mon, Jun 08, 2015 at 04:50:13PM +0200, jarod_v6--- via Tutor wrote: > Dear All; > I have a very silly problem. The right way to handle CSV files is to use the csv module: https://docs.python.org/2/library/csv.html http://pymotw.com/2/csv/ Some more comments further below. > with open("Dati_

Re: [Tutor] Problem on filtering data

2015-06-08 Thread Alan Gauld
On 08/06/15 15:50, jarod_v6--- via Tutor wrote: with open("Dati_differenzialigistvsminigist_solodiff.csv") as p: You are usually better off processing CSV files (or in your case tab separated) using the CSV module. for i in p: lines = i.strip("\n").split("\t") if lin

Re: [Tutor] Problem with installing python

2015-06-05 Thread Alan Gauld
On 05/06/15 07:45, Aditya Shaw wrote: I was trying to install Python 2.7 on my Windows 8.1(x64) PC and got the following error: "There is a problem with this Windows Istaller Package.A DLL required for this install to complete could not be run.Contact your support personnel or package vendor."

  1   2   3   4   5   6   >