Re: [Tutor] Pi approximation

2018-03-28 Thread boB Stepp
I see I wrote the below a little too quickly! Don't forget to take the reciprocal when printing. You might want to modify my naming of variables to reflect this. And return the reciprocal, which actually gives the pi approximation in the function form. On Wed, Mar 28, 2018 at 9:08 PM, boB Stepp

Re: [Tutor] Pi approximation

2018-03-28 Thread boB Stepp
On Wed, Mar 28, 2018 at 2:09 PM, Roger Lea Scherer wrote: > In one of my lessons I am asked to compare approximations for pi. I got > everything to work properly and my attempt is successful and matches > Python's approximation up to 15 digits to the right of the decimal, but I > suspect I can do

[Tutor] Pi approximation

2018-03-28 Thread Roger Lea Scherer
In one of my lessons I am asked to compare approximations for pi. I got everything to work properly and my attempt is successful and matches Python's approximation up to 15 digits to the right of the decimal, but I suspect I can do this programmatically rather than the repetitious way I did. I tri

Re: [Tutor] Sentiment analysis read from a file

2018-03-28 Thread Alan Gauld via Tutor
On 28/03/18 18:14, Peter Otten wrote: >> Just a quick response, but your data is more than a text file its a CSV next(open("training.txt")) > '1\tThe Da Vinci Code book is just awesome.\n' > > So the delimiter would be TAB: Ah! On my screen it looked like a space... > The CSV module prefers b

Re: [Tutor] Sentiment analysis read from a file

2018-03-28 Thread Rajesh Balel
seems you have "tab separated data with open('Training.txt') as f: my_data = [x.strip().split('\t') for x in f.readlines()] for x in my_data: print x, Regards Rajesh On Wed, Mar 28, 2018 at 10:14 AM, Peter Otten <__pete...@web.de> wrote: > Alan Gauld via Tutor wrote: > > > On 28/03/18 11:0

Re: [Tutor] (no subject)

2018-03-28 Thread Mats Wichmann
On 03/28/2018 04:32 AM, Steven D'Aprano wrote: > On Wed, Mar 28, 2018 at 03:08:00PM +0900, naoki_morih...@softbank.ne.jp wrote: >> I want to install 3rd party module, ex openpyxl. >> And I executed the following command in windows command prompt as follows: >> pip install openpyxl >> But pip is not

Re: [Tutor] Sentiment analysis read from a file

2018-03-28 Thread Peter Otten
Alan Gauld via Tutor wrote: > On 28/03/18 11:07, theano orf wrote: >> I am new in python and I am having problems of how to read a txt file and >> insert the data in a list, > > Just a quick response, but your data is more than a text file its a CSV > file so the rules change slightly. Especially

Re: [Tutor] Sentiment analysis read from a file

2018-03-28 Thread Alan Gauld via Tutor
On 28/03/18 11:07, theano orf wrote: > I am new in python and I am having problems of how to read a txt file and > insert the data in a list, Just a quick response, but your data is more than a text file its a CSV file so the rules change slightly. Especially since you are using the csv module.

Re: [Tutor] (no subject)

2018-03-28 Thread shubham goyal
Use this link to install python package and make sure to add the path in environment variables (just click the option it asks when you run the setup, Add Python to path or something). Recent python packages include pip also so you will get your problem solved. https://www.python.org/ftp/python/3.6

Re: [Tutor] (no subject)

2018-03-28 Thread Steven D'Aprano
On Wed, Mar 28, 2018 at 03:08:00PM +0900, naoki_morih...@softbank.ne.jp wrote: > I want to install 3rd party module, ex openpyxl. > And I executed the following command in windows command prompt as follows: > pip install openpyxl > But pip is not recognized as executable command at windows. What v

[Tutor] (no subject)

2018-03-28 Thread naoki_morihira
I want to install 3rd party module, ex openpyxl. And I executed the following command in windows command prompt as follows: pip install openpyxl But pip is not recognized as executable command at windows. I also tried the same way in python command line. But the result is the same. SyntaxError: inv