Re: [Tutor] Getting Started

2013-12-17 Thread Amit Saha
Hello Chris, On Wed, Dec 18, 2013 at 5:47 AM, Chris Acreman wrote: > I have programming experience using Fortran, Pascal, Modula 2, and some > training in C++. My nephew told me about Python and it sounded intriguing. > I downloaded Python 3.3.0 from this website (www.python.org) and installed >

Re: [Tutor] weird lambda expression -- can someone help me understand how this works

2013-12-13 Thread Amit Saha
On Sat, Dec 14, 2013 at 12:38 PM, Michael Crawford wrote: > Ah yes I see it. I forgot you can pass around functions in python. I would imagine, something in the apply() method, calling the 'mkdict' "function" with a value for the row parameter. -- http://echorand.me __

Re: [Tutor] weird lambda expression -- can someone help me understand how this works

2013-12-13 Thread Amit Saha
On Sat, Dec 14, 2013 at 12:29 PM, Amit Saha wrote: > On Sat, Dec 14, 2013 at 12:14 PM, Michael Crawford wrote: >> I found this piece of code on github >> >> https://gist.github.com/kljensen/5452382 >> >> def one_hot_dataframe(data, cols, replace=False): >>

Re: [Tutor] weird lambda expression -- can someone help me understand how this works

2013-12-13 Thread Amit Saha
On Sat, Dec 14, 2013 at 12:14 PM, Michael Crawford wrote: > I found this piece of code on github > > https://gist.github.com/kljensen/5452382 > > def one_hot_dataframe(data, cols, replace=False): > """ Takes a dataframe and a list of columns that need to be encoded. > Returns a 3-tuple

Re: [Tutor] list comprehension equivalent to map(function, list item)

2013-12-13 Thread Amit Saha
On Sat, Dec 14, 2013 at 11:03 AM, Bo Morris wrote: > i have the following simple function that iterates over the list. It passes > the list item into the function and adds the numbers. What would be the > equivalent way of writing the "map" portion with list comprehension? My code > is as follows:

Re: [Tutor] Unit testing in Python (3.3.0) for beginners

2013-12-09 Thread Amit Saha
On Sun, Dec 8, 2013 at 8:22 PM, Rafael Knuth wrote: > Hey there, > > I struggle to understand what unit testing specifically means in > practice and how to actually write unit tests for my code (my gut is > telling me that it's a fairly important concept to understand). > > Over the last few days

Re: [Tutor] What is a namespace? What is meant by "A namespace is a mapping from names to objects"

2013-12-09 Thread Amit Saha
On Mon, Dec 9, 2013 at 2:46 PM, Varuna Seneviratna wrote: >> Let’s begin with some definitions. >> >> A namespace is a mapping from names to objects. Most namespaces are >> currently implemented as Python dictionaries, but that’s normally not >> noticeable in any way (except for performance), and

Re: [Tutor] Converting integers into digit sum (Python 3.3.0)

2013-12-09 Thread Amit Saha
On Mon, Dec 9, 2013 at 6:08 PM, Rafael Knuth wrote: > Hej there, > > I wrote a program that converts an integer into a digit sum: > > def DigitSum(YourNumber): > DigitList = [] > YourNumber = str(YourNumber) > for i in YourNumber: > DigitList.append(int(i)) > print(sum(Digi

Re: [Tutor] Suggestion required on python as scripting language

2013-12-08 Thread Amit Saha
Hello, On Sun, Dec 8, 2013 at 4:59 PM, Shankar Donepudi wrote: > Hi All, > > I am working as test engineer in Networking in storage domain. We have > decided to automate our testing and have chosen python for the same. We have > basic knowledge on python so can anyone suggest good tutorials for w

Re: [Tutor] Unit testing in Python (3.3.0) for beginners

2013-12-08 Thread Amit Saha
On Sun, Dec 8, 2013 at 8:22 PM, Rafael Knuth wrote: > Hey there, > > I struggle to understand what unit testing specifically means in > practice and how to actually write unit tests for my code (my gut is > telling me that it's a fairly important concept to understand). Your gut feeling is right.

Re: [Tutor] Alternatives to append() for "growing" a list

2013-12-07 Thread Amit Saha
On Sun, Dec 1, 2013 at 7:27 PM, spir wrote: > On 12/01/2013 05:32 AM, Amit Saha wrote: >> >> Hello, >> >> I was told by someone (as a comment) that a code snippet such as this >> "would make Pythonistas talk my ear off about how evil the app

Re: [Tutor] Loop over floating point values

2013-12-07 Thread Amit Saha
On Mon, Dec 2, 2013 at 4:49 PM, eryksun wrote: > On Mon, Dec 2, 2013 at 1:28 AM, Amit Saha wrote: >> Indeed, that's a good point. Surprisingly, C does it just fine: >> >> # include >> >> int main(int argc, char **argv) >> { >> float x

Re: [Tutor] Alternatives to append() for "growing" a list

2013-12-07 Thread Amit Saha
On Tue, Dec 3, 2013 at 6:32 AM, Danny Yoo wrote: >> >> I was told by someone (as a comment) that a code snippet such as this >> "would make Pythonistas talk my ear off about how evil the append()" >> function is: >> > > > I think this thread demonstrates: we don't need an excuse to talk your ears

Re: [Tutor] Loop over floating point values

2013-12-02 Thread Amit Saha
On Mon, Dec 2, 2013 at 10:27 PM, Dave Angel wrote: > On Mon, 2 Dec 2013 16:28:38 +1000, Amit Saha wrote: >> >> Indeed, that's a good point. Surprisingly, C does it just fine: > > > >> # include > > > >> int main(int argc, char **argv) >> {

Re: [Tutor] Loop over floating point values

2013-12-01 Thread Amit Saha
On Mon, Dec 2, 2013 at 4:36 PM, Asokan Pichai wrote: > On Mon, Dec 2, 2013 at 11:58 AM, Amit Saha wrote: >> >> On Sun, Dec 1, 2013 at 7:26 PM, Steven D'Aprano >> wrote: >> > On Sun, Dec 01, 2013 at 07:03:15PM +1000, Amit Saha wrote: >> >> Hello,

Re: [Tutor] Loop over floating point values

2013-12-01 Thread Amit Saha
On Sun, Dec 1, 2013 at 7:47 PM, spir wrote: > On 12/01/2013 10:03 AM, Amit Saha wrote: >> >> Hello, >> >> Much to my disbelief, I realized I hadn't written a program in Python >> as far as I can recall which required me to do something like this, in >>

Re: [Tutor] Loop over floating point values

2013-12-01 Thread Amit Saha
On Sun, Dec 1, 2013 at 7:14 PM, Dominik George wrote: > Hi, > >> - Do not create a list of the floating point values as i=[0.01, 0.02, >> 0.03..] - either like that or by using a suitable mathematical formula >> combined with a list comprehension > > You could simply write your own version of xran

Re: [Tutor] Loop over floating point values

2013-12-01 Thread Amit Saha
On Sun, Dec 1, 2013 at 7:26 PM, Steven D'Aprano wrote: > On Sun, Dec 01, 2013 at 07:03:15PM +1000, Amit Saha wrote: >> Hello, >> >> Much to my disbelief, I realized I hadn't written a program in Python >> as far as I can recall which required me to do

[Tutor] Loop over floating point values

2013-12-01 Thread Amit Saha
Hello, Much to my disbelief, I realized I hadn't written a program in Python as far as I can recall which required me to do something like this, in psuedocode: x = 0.1 for i = 0 to x step 0.01 # do something with i end i Simply stated, I want to start from say a value, 0 and go upto 0.1 in incr

Re: [Tutor] Occurrence of number 2 in a range from 1 to 100

2013-12-01 Thread Amit Saha
Hello, On Sun, Dec 1, 2013 at 3:50 PM, Reuben wrote: > Hi, > > How can we write a logic for detecting the number 2 in range from 1 to 100 You question is unclear. Could you please give more details ? Best, Amit. -- http://echorand.me ___ Tutor mai

Re: [Tutor] Alternatives to append() for "growing" a list

2013-12-01 Thread Amit Saha
On Sun, Dec 1, 2013 at 5:04 PM, Steven D'Aprano wrote: > On Sun, Dec 01, 2013 at 02:32:38PM +1000, Amit Saha wrote: >> Hello, >> >> I was told by someone (as a comment) that a code snippet such as this >> "would make Pythonistas talk my ear off about

[Tutor] Alternatives to append() for "growing" a list

2013-11-30 Thread Amit Saha
Hello, I was told by someone (as a comment) that a code snippet such as this "would make Pythonistas talk my ear off about how evil the append()" function is: >>> mylist = [] >>> mylist.append(1) # a number of times over I have some ideas that on an append() the list's internal size increases (d

Re: [Tutor] Splitting lists with strings and integers

2013-11-26 Thread Amit Saha
On Wed, Nov 27, 2013 at 5:00 AM, Sam Lalonde wrote: > Hi, I am very new to python. > > I have a list with mixed strings/integers. I want to convert this to a list > of lists, and I want the numbers to get stored as integers. > list1 = ['dog 1 2', 'cat 3 4', 'mouse 5 6'] list2 = []

Re: [Tutor] minor display issue with python dictionaries

2013-11-24 Thread Amit Saha
On Mon, Nov 25, 2013 at 2:55 AM, Joel Goldstick wrote: > On Sun, Nov 24, 2013 at 11:03 AM, Reuben wrote: >> Hi, >> >> ## > > new_dict = {'a':10, 'b' :20, 'c': 30,'d' : 40} > > > print new_dict >> {'a': 10, 'c': 30, 'b': 20, 'd': 40}

Re: [Tutor] raw input program is still running.

2013-11-22 Thread Amit Saha
On Sat, Nov 23, 2013 at 7:02 AM, Imrose Baga wrote: > Hi I've just started using python. I tried to use raw input for name, city > and state. But only my name shows up and then when i try to close the > program, it is showed as still running and asks if I wish to kill the > program. please any hel

Re: [Tutor] Issue w/ while loops

2013-11-21 Thread Amit Saha
On Thu, Nov 21, 2013 at 9:00 PM, Rafael Knuth wrote: > Hej there, > > I want to use a while loop in a program (version used: Python 3.3.0), > and I expect it to loop unless the user enters an integer or a > floating-point number instead of a string. > > print("TIME TRACKING") > hours_worked = inpu

[Tutor] Fwd: Need help on Python API programmig

2013-11-16 Thread Amit Saha
Hi John, Perhaps your answer was directed towards Sourav. CCing tutor. -- Forwarded message -- From: John Steedman Date: Sun, Nov 17, 2013 at 6:26 AM Subject: Re: [Tutor] Need help on Python API programmig To: Amit Saha Hi Amit, I've been using Django Rest Framewor

Re: [Tutor] Need help on Python API programmig

2013-11-16 Thread Amit Saha
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 wrote: > Hi Amit, > > Yes I know, the question is not quite good. Currently I am trying to le

Re: [Tutor] Need help on Python API programmig

2013-11-15 Thread Amit Saha
Hello Sourav, On 16/11/2013 6:53 AM, "Sourav Biswas" 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

Re: [Tutor] Help merge files using python

2013-11-13 Thread Amit Saha
On Thu, Nov 14, 2013 at 8:26 AM, jarod...@libero.it wrote: > Hi I want to merge many files like this: > #file1 > A 10 > B 20 > C 30 > #file2 > B 45 > Z 10 > #file1 > A 60 > B 70 > C 10 > > I want to obtain > > A 10 0 60 > B 20 45 70 > C 30 0 10 > Z 0

Re: [Tutor] Hi!

2013-11-12 Thread Amit Saha
Hello, On Sun, Nov 10, 2013 at 7:04 AM, Vlad Olariu wrote: > Hello. I am new to python and mailing lists. Where should I post some code > if I need to? Welcome. Here is an example of a post with code. Assume that I am explaining to someone how they can exit out a while loop before the condition

Re: [Tutor] Python String Help

2013-10-29 Thread Amit Saha
On Oct 29, 2013 7:18 PM, "Alex Tenno" wrote: > > Hey everyone, > > I'm encountering a problem with a python function that I am supposed to create. I want my function to look at a string, and then replace each letter in the string with its relative position in the alphabet. for example, 'abcde' wou

Re: [Tutor] why does platform.architecture default to sys.executable?

2013-10-26 Thread Amit Saha
On Sun, Oct 27, 2013 at 7:46 AM, Alan Gauld wrote: > On 26/10/13 18:13, Amit Saha wrote: > >> a 64-bit system. Then, you can read /proc/cpuinfo and look for the lm >> flag. If it is present, it is a 64-bit system, > > > But that will only work on *nix systems I assum

Re: [Tutor] why does platform.architecture default to sys.executable?

2013-10-26 Thread Amit Saha
On Oct 27, 2013 2:51 AM, "Amit Saha" wrote: > > On Sun, Oct 27, 2013 at 2:39 AM, Albert-Jan Roskam wrote: > > Hi, > > > > Why does the "executable" parameter default to sys.executable? Yesterday I > > was surprised to see platform.architecture r

Re: [Tutor] why does platform.architecture default to sys.executable?

2013-10-26 Thread Amit Saha
On Sun, Oct 27, 2013 at 2:39 AM, Albert-Jan Roskam wrote: > Hi, > > Why does the "executable" parameter default to sys.executable? Yesterday I > was surprised to see platform.architecture return "32bit" on a 64-bit > system, just because a 32-bit Python interpreter was installed. Wouldn't > this m

Re: [Tutor] Easiest framework for web development?

2013-09-30 Thread Amit Saha
On Mon, Sep 30, 2013 at 7:15 PM, wrote: > Hi > > Which of the available Python frameworks is the EASIEST to learn for a > NEWBIE who needs to do *basic* web development? (only the *most basic* web > functionality will be needed) Only the *most basic* web functionality won't need you to use a Pyt

Re: [Tutor] writing python on the web

2013-09-30 Thread Amit Saha
On Tue, Oct 1, 2013 at 5:42 AM, Alan Gauld wrote: > On 30/09/13 13:49, roberto wrote: >> >> Hi, my school is considering a massive shift to Chromebooks. I've to >> carefully think about how could the students go on writing their python >> programs on the web. > > > It's not just Python it's any ki

Re: [Tutor] List Python Question..Please help

2013-09-27 Thread Amit Saha
On Sat, Sep 28, 2013 at 3:36 PM, Jacqueline Canales wrote: > Thank you guys so much i was able to figure it out. I definitely thought to > much into the the problem and made it harder on myself. Cant thank you > enough for assisting me. I have one more problem with the coding tho. > > composers =

Re: [Tutor] List Python Question..Please help

2013-09-27 Thread Amit Saha
Hi Jacqueline, On Sat, Sep 28, 2013 at 3:04 AM, Jacqueline Canales wrote: > composers = ['Antheil', 'Saint-Saens', 'Beethoven', 'Easdale', 'Nielsen'] > x = 'Antheil' > s = 'Saint-Saens' > h = 'Beethoven' > y = 'Easdale' > k = 'Nielsen' > > if s[0] == 'S' or s[0] == 's' == s[-1] == 'S' or s[-1] ==

Re: [Tutor] List Python Question..Please help

2013-09-27 Thread Amit Saha
On Fri, Sep 27, 2013 at 3:48 PM, Jacqueline Canales wrote: > So I have been trying to do this program using ifs and or loops. > I am having a hard time solving this question, If you could please assist me > in the right direction. > > Write a program that lists all the composers on the list ['Anth

Re: [Tutor] Checking that the input is float()-able

2013-09-22 Thread Amit Saha
On Sun, Sep 22, 2013 at 11:28 AM, Steven D'Aprano wrote: > On Sun, Sep 22, 2013 at 10:18:23AM +1000, Amit Saha wrote: >> Hi all, >> >> I want my program to report an error if anything other than a number >> which I can then convert to float using float() is en

[Tutor] A demon command line interpreter using the 'cmd' module

2013-09-21 Thread Amit Saha
I wrote this demo command line interpreter to demonstrate using the cmd module: https://gist.github.com/amitsaha/6047955 $ python3 demo_cmd_interpreter.py Welcome to Dummy shell. Type help or ? to list commands. dummyshell>> help Documented commands (type help ): =

[Tutor] Checking that the input is float()-able

2013-09-21 Thread Amit Saha
Hi all, I want my program to report an error if anything other than a number which I can then convert to float using float() is entered as input: # Python 3 try: a = float(input('Enter a number: ')) except ValueError: print('Wrong input') else: print('Right input') This seems to do

Re: [Tutor] Copy and paste python on Microsoft word

2013-09-18 Thread Amit Saha
On Wed, Sep 18, 2013 at 2:59 PM, Sammy Cornet wrote: > I'm using python 3.3.0, I have made a program on my script and output it. I > have tried several times to copy and paste the output and the script on > Microsoft word, every time I select the part that I need and right click on > it, this m

Re: [Tutor] Web Services with python

2013-09-18 Thread Amit Saha
On Wed, Sep 18, 2013 at 7:05 PM, Ismar Sehic wrote: > Hello, can someone point me to some good guality resources to learn Web > Services with Python?with some exaples, tutorials, exercises and such. What do you want to do? Do you want to connect to a remote server or do you want to implement a se

Re: [Tutor] Python Programming Help

2013-09-11 Thread Amit Saha
On Wed, Sep 11, 2013 at 7:59 PM, Oscar Benjamin wrote: > On 11 September 2013 10:48, Amit Saha wrote: >> Hi Katie, >> >> So, before you write the solution to the programming problem above, >> can you first try to write a program and then run it? What operating >&g

Re: [Tutor] Python Programming Help

2013-09-11 Thread Amit Saha
Hi Katie, On Wed, Sep 11, 2013 at 11:01 AM, Katie wrote: > Hello, > > I am a beginner in computer programming. I am studying math, and the math > class that I will be taking requires knowledge in Python. So, I am in a > computer science class. Therefore, I do not have an in-depth knowledge of > c

Re: [Tutor] cs student needs help import math

2013-09-07 Thread Amit Saha
On Sun, Sep 8, 2013 at 8:02 AM, Byron Ruffin wrote: > I am writing a simple program based off an ipo chart that I did correctly. > I need to use ceil but I keep getting an error saying ceil is not defined. > I did import math, I think. I am using 3.2.3 and I imported this way... > import mat

Re: [Tutor] How to present python experience (self-taught) to potential employer

2013-08-22 Thread Amit Saha
On Fri, Aug 23, 2013 at 1:52 PM, Jing Ai wrote: > @Amit > Thank you for your suggestions! I'll look into the data there and see if > there's something relevant that I can use to do a project. Yes I believe it > would involve some data analysis (and I may need to learn R as well or use > RPy). D

Re: [Tutor] How to present python experience (self-taught) to potential employer

2013-08-22 Thread Amit Saha
Hi Jing Ai, On Fri, Aug 23, 2013 at 12:45 PM, Jing Ai wrote: > Hi everyone, > This is Jing and I am a recent college graduate with Biology and Public > Health background. I'm currently learning python on my own when i have time > off from my PH internship. There's a job posting that looks reall

Re: [Tutor] How much in a "try" block?

2013-08-22 Thread Amit Saha
On Fri, Aug 23, 2013 at 10:30 AM, Alan Gauld wrote: > On 22/08/13 21:27, Chris Down wrote: > >> You can also use the "else" clause if there is stuff you want to run if >> the try >> block doesn't raise the caught exception, which avoids putting it in "try" >> if >> you don't intend to exit from th

Re: [Tutor] How much in a "try" block?

2013-08-22 Thread Amit Saha
On Fri, Aug 23, 2013 at 6:14 AM, leam hall wrote: > If I have a series of tasks that depend on X happening, should I put them > all in the same "try" block or just put X in there and exit out if it fails? You are right about the latter. You should put only the statement which you expect to raise

Re: [Tutor] Unix Environment variables

2013-06-23 Thread Amit Saha
Hello, On Tue, Jun 18, 2013 at 9:58 AM, Anu Bhagat wrote: > Hi I am fairly new to python. I will greatly appreciate if some one can tell > me how set up environment variables from a python script. > > Thanks in advance. You can use the 'os' module. This is the document for Python 2 [1]. That sho

Re: [Tutor] Python and Symbolic Math for beginners

2013-06-16 Thread Amit Saha
On Mon, Jun 17, 2013 at 1:25 PM, Jim Mooney wrote: > On 16 June 2013 20:18, Amit Saha wrote: >> >> This is a new tutorial the SymPy guys are working on: >> http://docs.sympy.org/tutorial/tutorial/index.html > > Thanks. A lot of math bored me but I see it has matrices,

Re: [Tutor] Python and Symbolic Math for beginners

2013-06-16 Thread Amit Saha
On Mon, Jun 17, 2013 at 1:25 PM, Jim Mooney wrote: > On 16 June 2013 20:18, Amit Saha wrote: >> >> This is a new tutorial the SymPy guys are working on: >> http://docs.sympy.org/tutorial/tutorial/index.html > > Thanks. A lot of math bored me but I see it has matrices,

Re: [Tutor] Python and Symbolic Math for beginners

2013-06-16 Thread Amit Saha
On Mon, Jun 17, 2013 at 1:16 PM, Jim Mooney wrote: >> yeah, I am playing with the Python 3 version. Works great so far. > > I didn't even look at the docs, but I think I got the solve part > working. I cut down on typing a bit, though. Typing Symbol all day > long could get tedious: > > from sympy

Re: [Tutor] Python and Symbolic Math for beginners

2013-06-16 Thread Amit Saha
On Mon, Jun 17, 2013 at 12:47 PM, Jim Mooney wrote: > On 16 June 2013 18:28, Amit Saha wrote: >> On Mon, Jun 17, 2013 at 11:25 AM, bob gailer wrote: >>> On 6/15/2013 5:53 AM, Amit Saha wrote: >>>> >>>> Symbolic math? >>> >>> What

Re: [Tutor] Python and Symbolic Math for beginners

2013-06-16 Thread Amit Saha
On Mon, Jun 17, 2013 at 12:14 PM, epi wrote: > i guess you'll find this pretty interesting : > > http://nbviewer.ipython.org/url/edu.scios.ch/sympy/nb_sample_sympy.ipynb > > sympy latex rendering using the ipython notebook … > > Have fun ;) Thanks, I am aware of that. I was asking for any other b

Re: [Tutor] Python and Symbolic Math for beginners

2013-06-16 Thread Amit Saha
On Mon, Jun 17, 2013 at 11:25 AM, bob gailer wrote: > On 6/15/2013 5:53 AM, Amit Saha wrote: >> >> Symbolic math? > > What is that? Eg: https://gist.github.com/amitsaha/5787802 -- http://echorand.me ___ Tutor maillist -

[Tutor] Python and Symbolic Math for beginners

2013-06-15 Thread Amit Saha
Hello Tutors, Would any of you have any teaching (or substantial self learning) experience with a library for Symbolic math? I am currently exploring sympy (http://sympy.org) as part of writing a book chapter and would like to know if there any better/easier option out there which can successfull

Re: [Tutor] trying to split or rpartition the contents of a list

2013-05-23 Thread Amit Saha
Hi Stuart, On Thu, May 23, 2013 at 10:57 PM, Stuart Tozer wrote: > Hello Amit- your solution works very well. Thanks very much! Good to know that! Hope it was clear. All the best. -Amit > > Best regards, > Stu > > > On Wed, May 22, 2013 at 11:39 AM, Stuart Tozer wrote: >> >> Thanks very much

Re: [Tutor] trying to split or rpartition the contents of a list

2013-05-22 Thread Amit Saha
Hello, On Wed, May 22, 2013 at 5:49 PM, Stuart Tozer wrote: > Hi everyone. > > I'm stuck on a problem while developing a small tool for Maya. Basically, I > have a folder with some filenames in it which have been returned by > os.listdir(). These filenames look something like... > > > apple_d.jpg

Re: [Tutor] Which version of python should i use?

2013-05-20 Thread Amit Saha
Hello Amal, On Mon, May 20, 2013 at 11:24 PM, Amal Thomas wrote: > Thank you very much..!! I am starting to learn python for my Bioinformatics > work, so I would look for the version that has libraries helpful for me.. Do you already have any libraries in mind (or aware of) that you would want

Re: [Tutor] Random Number Game: Returns always the same number - why?

2013-05-20 Thread Amit Saha
Hi Rafael, On Tue, May 21, 2013 at 2:51 AM, Rafael Knuth wrote: > > Your variable assignment for Random_Number is outside of your while > loop. Therefore its value never changes. Put it inside the while loop > just before the print statement and I think you will get what you > > That was it! Tha

Re: [Tutor] Python Programming for the Absolute Beginner

2013-05-15 Thread Amit Saha
Hi Grace, On Thu, May 2, 2013 at 8:04 AM, Grace Kathryn wrote: > Hello~ > > I'm working through the Book Python Programming for the Absolute Beginner > and am wondering if you could help me out with the coding to certain > Challenges at the end of the book, specifically chapter 7 challenges 1 an

Re: [Tutor] Making a Primary Number List generator

2013-05-12 Thread Amit Saha
On Sun, May 12, 2013 at 9:43 PM, Dave Angel wrote: > On 05/11/2013 09:58 PM, Daniel Magruder wrote: > > Please respond to the list, not the individual. Otherwise you're robbing > yourself and others of the possibility of learning from and helping multiple > people. I don't mind if you ALSO reply

Re: [Tutor] Unknown Cause of Error

2013-05-10 Thread Amit Saha
On Sat, May 11, 2013 at 12:13 PM, Jack Little wrote: > I have a slight problem. My program will not open. On top of that, I have > written similar programs all to no avail. I am creating a text adventure and > want there to be different rooms. Here is my code: > > > def menu(): > print "Welcom

Re: [Tutor] PyScripter header?

2013-05-08 Thread Amit Saha
On Wed, May 8, 2013 at 6:10 PM, Jim Mooney wrote: > I'm trying PyScripter instead of Wing 101. It works fine and has a lot > more PyLearner features than Wing 101 (at the same price ;'), such as > popups showing the parameters for methods, profiler, lint, > programmable snippets, etc. It also lets

Re: [Tutor] exit message

2013-05-05 Thread Amit Saha
On Mon, May 6, 2013 at 2:56 PM, Jim Mooney wrote: >> Something like this? >> import sys > while 1: >> ... sys.exit('Exiting from Infinite Loop') >> ... >> Exiting from Infinite Loop > > I still get a traceback message from the console. I just want a clean > exit without that. I have a

Re: [Tutor] exit message

2013-05-05 Thread Amit Saha
On Mon, May 6, 2013 at 2:24 PM, Jim Mooney wrote: > I've noticed that if you exit() a program you always get a traceback message: > Traceback (most recent call last): > File "", line 1, in > exit('what now?') > File "C:\Python33\lib\site.py", line 380, in __call__ > raise SystemExit(c

Re: [Tutor] changing list element in loop

2013-04-27 Thread Amit Saha
On Sat, Apr 27, 2013 at 8:31 PM, Jim Mooney wrote: > On 27 April 2013 02:55, Amit Saha wrote: >> On Sat, Apr 27, 2013 at 7:49 PM, Jim Mooney wrote: >>> Why isn't 'e' changing to 'pP here when the vowel list is mutable: >>> >>> vowelList =

Re: [Tutor] changing list element in loop

2013-04-27 Thread Amit Saha
On Sat, Apr 27, 2013 at 7:49 PM, Jim Mooney wrote: > Why isn't 'e' changing to 'pP here when the vowel list is mutable: > > vowelList = list('aeiouy') > > for x in vowelList: > if x == 'e': > x = 'P' This is because x is really a label for the item in your list. It does not represent

Re: [Tutor] Processing Linux command line output

2013-04-24 Thread Amit Saha
Hi Gareth, On Thu, Apr 25, 2013 at 8:03 AM, Gareth Allen wrote: > Hi all, > > I'm trying to get the output of a command and split it into a list that I > can process. What is the best way to go about doing this? In bash I would > use tools like grep, sed awk etc. > > Here's an example: > > ifcon

Re: [Tutor] Python Script: Downloading Youtube videos by search result

2013-04-19 Thread Amit Saha
On Fri, Apr 19, 2013 at 9:44 PM, Sayan Chatterjee wrote: > Dear All, > > I want to download some music from youtube.There are already marvellous > python scripts like youtube-dl which downloads videos and playlists from > numerous sites,but what I want to do is to download videos from youtube with

Re: [Tutor] Looks like a judgment bug.

2013-04-11 Thread Amit Saha
On Fri, Apr 12, 2013 at 1:42 PM, Amit Saha wrote: > On Fri, Apr 12, 2013 at 1:36 PM, Steven D'Aprano wrote: >> On 12/04/13 12:53, Amit Saha wrote: >> >>> So for example: >>> >>>>>> a=1 >>>>>> b=1 >>>>>>

Re: [Tutor] Looks like a judgment bug.

2013-04-11 Thread Amit Saha
On Fri, Apr 12, 2013 at 1:36 PM, Steven D'Aprano wrote: > On 12/04/13 12:53, Amit Saha wrote: > >> So for example: >> >>>>> a=1 >>>>> b=1 >>>>> a is b >> >> True >>>>> >>>>> id(a)

Re: [Tutor] Looks like a judgment bug.

2013-04-11 Thread Amit Saha
On Thu, Apr 11, 2013 at 8:41 PM, w qj wrote: > I found this under Windows Python3 l="http://f/"; l[-1] is not '/' > False > > and this under Linux Python3 l = "http://ff.f/"; l[-1] > '/' l[-1] is not '/' > True > > It's Looks like a python bug? No, this is not. The '

Re: [Tutor] Sharing Code Snippets

2013-04-11 Thread Amit Saha
On Thu, Apr 11, 2013 at 9:33 PM, Albert-Jan Roskam wrote: >> Subject: [Tutor] Sharing Code Snippets >> >> Hello everyone, >> >> I am not sure if this has been shared on this list. However, to help >> both those seeking help and those wanting to help, may I suggest that >> for all of you posting yo

[Tutor] Sharing Code Snippets

2013-04-10 Thread Amit Saha
Hello everyone, I am not sure if this has been shared on this list. However, to help both those seeking help and those wanting to help, may I suggest that for all of you posting your programs, how about using a service such as GitHub's Gists [1]. It allows you to post entire programs with advantag

Re: [Tutor] Running python from windows command prompt

2013-04-10 Thread Amit Saha
On Wed, Apr 10, 2013 at 10:32 PM, Arijit Ukil wrote: > I like to run a python program "my_python.py" from windows command prompt. > This program ( a function called testing) takes input as block data (say > data = [1,2,3,4] and outputs processed single data. > > import math > > def avrg(data): >

Re: [Tutor] Running python from windows command prompt

2013-04-10 Thread Amit Saha
On Wed, Apr 10, 2013 at 10:32 PM, Arijit Ukil wrote: > I like to run a python program "my_python.py" from windows command prompt. > This program ( a function called testing) takes input as block data (say > data = [1,2,3,4] and outputs processed single data. > > import math > > def avrg(data): >

Re: [Tutor] building a website with python

2013-04-09 Thread Amit Saha
On Wed, Apr 10, 2013 at 12:47 PM, Amit Saha wrote: > On Wed, Apr 10, 2013 at 7:31 AM, Benjamin Fishbein > wrote: >> Hello. I learned Python this past year (with help from many of you) and >> wrote many programs for my small business. Now I want to build a website. I >>

Re: [Tutor] building a website with python

2013-04-09 Thread Amit Saha
On Wed, Apr 10, 2013 at 7:31 AM, Benjamin Fishbein wrote: > Hello. I learned Python this past year (with help from many of you) and wrote > many programs for my small business. Now I want to build a website. I > acquired the domain name through godaddy.com (bookchicken.com) but have not > found

Re: [Tutor] building a website with python

2013-04-09 Thread Amit Saha
On Wed, Apr 10, 2013 at 12:03 PM, Don Jennings wrote: > > On Apr 9, 2013, at 5:31 PM, Benjamin Fishbein wrote: > >> Hello. I learned Python this past year (with help from many of you) and >> wrote many programs for my small business. Now I want to build a website. I >> acquired the domain name t

Re: [Tutor] FW: Fwd: (no subject)

2013-03-30 Thread Amit Saha
On Sun, Mar 31, 2013 at 1:14 PM, Soliman, Yasmin wrote: > Yes this does help. I'm going to play around with it a bit, thank you so much > for your patience and time! Great. Good Luck! ___ Tutor maillist - Tutor@python.org To unsubscribe or change sub

Re: [Tutor] FW: Fwd: (no subject)

2013-03-30 Thread Amit Saha
On Sun, Mar 31, 2013 at 12:39 PM, Soliman, Yasmin wrote: > So if it should look like this, it gives error that says Quit is not defined, > also why does it not recognize the sys import when I run it? > > import weekday_string1 > import sys > while True: > ryear = raw_input("year= ") > pri

Re: [Tutor] FW: Fwd: (no subject)

2013-03-30 Thread Amit Saha
On Sun, Mar 31, 2013 at 12:51 PM, Soliman, Yasmin wrote: > yes, your program does work. The problem is if I run that similar statment in > my program, say I enter the year and for month I write Quit, it says quit is > not defined. I suppose in this senerio I would have to use the sys.exit()? Do

[Tutor] Fwd: (no subject)

2013-03-30 Thread Amit Saha
Sorry, forgot to have tutor in the CC. On Sun, Mar 31, 2013 at 12:08 PM, Soliman, Yasmin wrote: > Sure here it is: > > import weekday_string1 > while True: > ryear = raw_input("year= ") > print ryear > if not ryear.isdigit(): > print '\nThank you for using this program! Bye.'

Re: [Tutor] (no subject)

2013-03-30 Thread Amit Saha
On Sun, Mar 31, 2013 at 11:49 AM, Soliman, Yasmin wrote: > Hello everyone. How can I get a program to stop only when the user enters > 'Quit'? You would need an "infinite" loop in your program, where you take user input. Check if the input entered was 'Quit', and only exit/break out of your loop

Re: [Tutor] How to check if user input is an integer

2013-03-29 Thread Amit Saha
On Fri, Mar 29, 2013 at 9:35 PM, Amit Saha wrote: > On Fri, Mar 29, 2013 at 9:33 PM, Ghadir Ghasemi > wrote: >> Hi guys I am trying to create part of a vending machine. The section below >> is if the user wants to insert 50p coins. It works but when I entered a non >> i

Re: [Tutor] How to check if user input is an integer

2013-03-29 Thread Amit Saha
On Fri, Mar 29, 2013 at 9:39 PM, Amit Saha wrote: > On Fri, Mar 29, 2013 at 9:35 PM, Amit Saha wrote: >> On Fri, Mar 29, 2013 at 9:33 PM, Ghadir Ghasemi >> wrote: >>> Hi guys I am trying to create part of a vending machine. The section below >>> is if the u

Re: [Tutor] How to check if user input is an integer

2013-03-29 Thread Amit Saha
On Fri, Mar 29, 2013 at 9:33 PM, Ghadir Ghasemi wrote: > Hi guys I am trying to create part of a vending machine. The section below is > if the user wants to insert 50p coins. It works but when I entered a non > integer like 'dfsdf', the program just broke. Is there a way that the program > can

Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-27 Thread Amit Saha
On Wed, Mar 27, 2013 at 11:05 PM, Sean Carolan wrote: > >> But, where did you get the idea that you could build Python RPMs using >> $python setup.py bdist_rpm ? I thought that was only limited to >> building RPMs for python packages (including extensions), but not the >> Python interpreter itself

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-26 Thread Amit Saha
On Wed, Mar 27, 2013 at 4:36 PM, Sayan Chatterjee wrote: > Thanks a lot for your prompt reply. > > 1. Yes. This is exactly what I wanted. Creating a bunch of data sets and > then writing script to plot them using gnuplot, but if something can produce > directly 'plots' it will certainly be helpful

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-26 Thread Amit Saha
On Wed, Mar 27, 2013 at 4:23 PM, Amit Saha wrote: > Hi Sayan, > > On Wed, Mar 27, 2013 at 4:14 PM, Sayan Chatterjee > wrote: >> Dear All, >> >> I am a newbie to Python but have a fair know how of other languages i.e C >> etc. >> >> I want to run a

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-26 Thread Amit Saha
Hi Sayan, On Wed, Mar 27, 2013 at 4:14 PM, Sayan Chatterjee wrote: > Dear All, > > I am a newbie to Python but have a fair know how of other languages i.e C > etc. > > I want to run an astrophysical simulation in Python. All I have to do it to > generate a set of 'plots' depending on a varying pa

Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Amit Saha
On Wed, Mar 27, 2013 at 7:32 AM, Sean Carolan wrote: > >> Given that most folks on this list are only learning Python its pretty >> unlikely that they are building bespoke RPMs... >> >> You might find more experience of RPM building on the general Python >> mailing list/newsgroup. > > > Sorry 'bou

Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Amit Saha
On Wed, Mar 27, 2013 at 7:32 AM, Sean Carolan wrote: > >> Given that most folks on this list are only learning Python its pretty >> unlikely that they are building bespoke RPMs... >> >> You might find more experience of RPM building on the general Python >> mailing list/newsgroup. > > > Sorry 'bou

Re: [Tutor] Building Python 2.7.3 on RHEL 5.8 x86_64 -- Syntax Error

2013-03-26 Thread Amit Saha
On Wed, Mar 27, 2013 at 12:55 AM, Sean Carolan wrote: > I'm attempting to use setup.py to build an RPM, but ran into this error: > > [scarolan@cobbler:~/rpmbuild/BUILD/Python-2.7.3]$ python27 setup.py > bdist_rpm > > File "setup.py", line 361 > with open(tmpfile) as fp: > ^ > Syn

Re: [Tutor] Importing data from a file.

2013-03-21 Thread Amit Saha
On Thu, Mar 21, 2013 at 11:43 PM, Shall, Sydney wrote: > I have an elementary question provoked by another post today. > > 1. Is it the case that ALL imported data from a file is a string? > 2. Does this therefor imply that said data has to be processed appropriately > to generate the data in the

  1   2   >