Re: [Tutor] Running Files with Command Lines

2012-02-12 Thread Alan Gauld
On 12/02/12 07:24, Yony Torres wrote: "Once you’ve saved this text file, you can ask Python to run it > by listing its full filename as the first argument to a > python command, typed at the system shell prompt:" % python script1.py Lets break down what this line is saying. It comprises thre

Re: [Tutor] (no subject)

2012-02-12 Thread Evert Rol
Hi, Tip: use a meaningful subject line; attracts more/better attention and makes it easier to trace your email in the archives. Continued at the bottom. > import numpy as np > import matplotlib.pyplot as plt > E=[81.97400737666324, 322.0939978589591, 694.5766491226185] > V0=1000 > a=0.1 > def

Re: [Tutor] repeat a sequence in range

2012-02-12 Thread Peter Otten
Michael Lewis wrote: > I am trying to repeat a certain sequence in a range if a certain even > occurs. Forgive me for not pasting my code; but I am not at the machine > where it's saved. > > Basically, I want to get user input and append that input to a list only > if the input is not already in

Re: [Tutor] Running Files with Command Lines

2012-02-12 Thread bob gailer
On 2/12/2012 2:21 AM, Yony Torres wrote: Hello buddies I'm trying to learn Python from a well known book, and i'm stuck with something that i know that might seem surprisingly easy for you and i would like to humbly request your help: i created a script in a file named script1.py and i save

[Tutor] how to stop a running program in python without closing python interface?

2012-02-12 Thread Debashish Saha
actually a i ran a progam in python which is sufficiently large . so i want to stop the execution of the program now . how can i do this? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman

Re: [Tutor] how to stop a running program in python without closing python interface?

2012-02-12 Thread David Smith
On 12 Feb 2012, at 11:54, Debashish Saha wrote: > actually a i ran a progam in python which is sufficiently large . so i > want to stop the execution of the program now . how can i do this? This will depend on your operating system. On a Mac you press alt + command + esc and the choose the prog

[Tutor] how to print a string in desired colour

2012-02-12 Thread Debashish Saha
suppose i want to print 'hello world' in color blue.so what to do? i tried print 'hello world','blue' ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to stop a running program in python without closing python interface?

2012-02-12 Thread Evert Rol
>> actually a i ran a progam in python which is sufficiently large . so i >> want to stop the execution of the program now . how can i do this? > > This will depend on your operating system. > > On a Mac you press alt + command + esc and the choose the program you want to > Force Quit. I have no

Re: [Tutor] how to print a string in desired colour

2012-02-12 Thread Scott Nelson
On Sun, Feb 12, 2012 at 6:47 AM, Debashish Saha wrote: > suppose i want to print 'hello world' in color blue.so what to do? > > There was a similar thread awhile ago. Unfortunately the answer isn't an easy one. It depends on what operating system you use. Here's a link to the old thread: http:

[Tutor] string integers?

2012-02-12 Thread William Stewart
I am trying to get 2 string variables and 2 integer variables to be able to be multiplied can anyone tell me what I did wrong   str1 = raw_input("Type in a String: ") str2 = raw_input("Type in a String: ") int1 = raw_input("Type in a integer variable: ") int2 = raw_input("Type in a integer variabl

Re: [Tutor] how to print a string in desired colour

2012-02-12 Thread bob gailer
Please always tell us which OS you are using, which version of Python. When something you try does not give you the result you want, please tell us what you got. In a case like this also tell us where you want the colored text to appear. It may be obvious to you but it is not to us. Given h

Re: [Tutor] string integers?

2012-02-12 Thread Hugo Arts
On Sun, Feb 12, 2012 at 2:25 PM, William Stewart wrote: > I am trying to get 2 string variables and 2 integer variables to be able > to be multiplied > can anyone tell me what I did wrong > > str1 = raw_input("Type in a String: ") > str2 = raw_input("Type in a String: ") > int1 = raw_input("Type

Re: [Tutor] string integers?

2012-02-12 Thread Brian van den Broek
On 12 Feb 2012 15:28, "William Stewart" wrote: > > I am trying to get 2 string variables and 2 integer variables to be able to be multiplied > can anyone tell me what I did wrong > > str1 = raw_input("Type in a String: ") > str2 = raw_input("Type in a String: ") > int1 = raw_input("Type in a integ

Re: [Tutor] how to print a string in desired colour

2012-02-12 Thread Devin Jeanpierre
On Sun, Feb 12, 2012 at 8:02 AM, Scott Nelson wrote: > On Sun, Feb 12, 2012 at 6:47 AM, Debashish Saha wrote: >> >> suppose i want to print 'hello world' in color blue.so what to do? >> > > There was a similar thread awhile ago.  Unfortunately the answer isn't an > easy one.  It depends on what o

[Tutor] Same code has different result

2012-02-12 Thread daedae11
The code is: from nntplib import NNTP s = NNTP('news.gmane.org') resp, count, first, last, name = s.group('gmane.comp.python.committers') print 'Group', name, 'has', count, 'articles, range', first, 'to', last resp, subs = s.xhdr('subject', first + '-' + last) for id, sub in subs[-10:]: print i

Re: [Tutor] exercise with classes 2nd attempt

2012-02-12 Thread Brian van den Broek
On 12 Feb 2012 05:23, "Tonu Mikk" wrote: > > I am learning Python using the "Learn Python the Hard Way" book by Zed Shaw. I reached exercise 42 where we learn about Python classes. The exercise shows a game with one class that includes all the definitions for playing the game. For extra credit

Re: [Tutor] string integers?

2012-02-12 Thread Dave Angel
On 02/12/2012 08:25 AM, William Stewart wrote: I am trying to get 2 string variables and 2 integer variables to be able to be multiplied can anyone tell me what I did wrong str1 = raw_input("Type in a String: ") str2 = raw_input("Type in a String: ") int1 = raw_input("Type in a integer varia

Re: [Tutor] Same code has different result

2012-02-12 Thread Andreas Perstinger
On Sun, 12 Feb 2012 21:31:57 +0800 daedae11 wrote: > The code is: > from nntplib import NNTP > s = NNTP('news.gmane.org') > resp, count, first, last, name = s.group > ('gmane.comp.python.committers') print 'Group', name, 'has', count, > 'articles, range', first, 'to', last resp, subs = s.xhdr('su

Re: [Tutor] string integers?

2012-02-12 Thread Mark Lawrence
On 12/02/2012 14:51, Dave Angel wrote: On 02/12/2012 08:25 AM, William Stewart wrote: [snipped] My usual advice when seeing a beginner with a complex line that gives a syntax error is to see if you can replace it by a few simpler lines. Then the error might be more obvious. So use several pri

Re: [Tutor] Running Files with Command Lines

2012-02-12 Thread Yony Torres
hello there :) ima try it one more time, ima pasting the previous email content i sent previously so here it goes ;P I'm working in a windows vista home premium system i installed python 3.2.2 I'm trying to learn Python from a well known book, and i'm stuck with  > something that i know that migh

Re: [Tutor] Running Files with Command Lines

2012-02-12 Thread Alan Gauld
On 12/02/12 15:50, Yony Torres wrote: I'm trying to learn Python from a well known book, Do0n;t make us guess, tell us the name of the book, well known or not. There is just a chance somebody else may have read it too! while i was working with the windows CMD c:\Python32>python This is

Re: [Tutor] Running Files with Command Lines

2012-02-12 Thread Yony Torres
1. i tried this morning and it worked in the CMD check it out: copied and pasted from the CMD C:\Users\myusername>cd documents C:\Users\myusername\Documents>cd varios2 C:\Users\myusername\Documents\varios2>cd pythonjourney C:\Users\myusername\Documents\varios2\pythonjourney>script.py    <---

Re: [Tutor] Same code has different result

2012-02-12 Thread Andreas Perstinger
[You've forgot to include the list in your reply] On Mon, 13 Feb 2012 00:04:54 +0800 daedae11 wrote: > Sorry, I'm not sure I know your viewpoint. Could you give me a > detailed explanation about "you need more than about 6-7 seconds (on > my computer) to type the third line."? Thank you very muc

Re: [Tutor] Running Files with Command Lines

2012-02-12 Thread Yony Torres
oh i forgot this: The book i bought and which im reading from is Learning Python - Mark Lutz - O'reilly > From: talmi...@live.com > To: alan.ga...@btinternet.com; tutor@python.org > Date: Sun, 12 Feb 2012 11:57:57 -0500 > Subject: Re: [Tutor] Running Fil

Re: [Tutor] Same code has different result

2012-02-12 Thread Dave Angel
On 02/12/2012 12:02 PM, Andreas Perstinger wrote: [You've forgot to include the list in your reply] On Mon, 13 Feb 2012 00:04:54 +0800 daedae11 wrote: Sorry, I'm not sure I know your viewpoint. Could you give me a detailed explanation about "you need more than about 6-7 seconds (on my compute

Re: [Tutor] Running Files with Command Lines

2012-02-12 Thread Dave Angel
On 02/12/2012 11:57 AM, Yony Torres wrote: 1. i tried this morning and it worked in the CMD check it out: copied and pasted from the CMD C:\Users\myusername>cd documents C:\Users\myusername\Documents>cd varios2 C:\Users\myusername\Documents\varios2>cd pythonjourney C:\Users\myusername\Documents\

Re: [Tutor] Concatenating multiple lines into one

2012-02-12 Thread Spyros Charonis
Thanks for all the help, Peter's and Hugo's methods worked well in concatenating multiple lines into a single data structure! S On Fri, Feb 10, 2012 at 5:30 PM, Mark Lawrence wrote: > On 10/02/2012 17:08, Peter Otten wrote: > >> Spyros Charonis wrote: >> >> Dear python community, >>> >>> I have

Re: [Tutor] how to stop a running program in python without closing python interface?

2012-02-12 Thread Steven D'Aprano
Debashish Saha wrote: actually a i ran a progam in python which is sufficiently large . so i want to stop the execution of the program now . how can i do this? Control-C should work on every operating system. Obviously you have send the Ctrl-C to the Python process, not some other application.

Re: [Tutor] string integers?

2012-02-12 Thread Brian van den Broek
On 12 February 2012 21:27, William Stewart wrote: > > thanks i tried the code and it doesnt make anydiffference what I need is it > to multiply now I fixed the error message but how do I get the 2 numbers that > the person enters to multiply > > --- On Sun, 2/12/12, Brian van den Broek > wrote

Re: [Tutor] string integers?

2012-02-12 Thread William Stewart
this is the code I have   str1 = raw_input("Type in a String: ") str2 = raw_input("Type in a String: ") int1 = raw_input("Type in a integer variable: ") int2 = raw_input("Type in a integer variable: ") print str1 + str2 + int1 + int2 import math int1 = int(raw_input("")) print str1, print str2, pri

Re: [Tutor] string integers?

2012-02-12 Thread Steven D'Aprano
William Stewart wrote: this is the code I have str1 = raw_input("Type in a String: ") str2 = raw_input("Type in a String: ") int1 = raw_input("Type in a integer variable: ") int2 = raw_input("Type in a integer variable: ") print str1 + str2 + int1 + int2 import math int1 = int(raw_input("")) p

Re: [Tutor] string integers?

2012-02-12 Thread amt
Hello William and welcome to the Python list. I'm a beginner but I'll give it a shot. Problem is, you use raw_input and it returns a string, not an int. Try this code: str1 = raw_input("Type in a String: ") str2 = raw_input("Type in a String: ") int1 = int(raw_input("Type in a integer variable:

Re: [Tutor] string integers?

2012-02-12 Thread Brian van den Broek
On 13 February 2012 01:34, William Stewart wrote: > > this is the code I have > > str1 = raw_input("Type in a String: ") > str2 = raw_input("Type in a String: ") > int1 = raw_input("Type in a integer variable: ") > int2 = raw_input("Type in a integer variable: ") > print str1 + str2 + int1 + int2

Re: [Tutor] string integers?

2012-02-12 Thread William Stewart
Thank you for the reply It worked fine ! --- On Sun, 2/12/12, Steven D'Aprano wrote: From: Steven D'Aprano Subject: Re: [Tutor] string integers? To: tutor@python.org Date: Sunday, February 12, 2012, 6:50 PM William Stewart wrote: > this is the code I have >  str1 = raw_input("Type in a Strin

[Tutor] tabbed output

2012-02-12 Thread Michael Lewis
I am having a weird issue. I have a print statement that will give me multiple outputs separated by a tab; however, sometimes there is a tab between the output and sometimes there is not. It seems sort of sporadic. My code is below and two sample outputs are below that (one that works how I expect,

Re: [Tutor] how to stop a running program in python without closing python interface?

2012-02-12 Thread Mark Lawrence
On 12/02/2012 22:19, Steven D'Aprano wrote: Debashish Saha wrote: actually a i ran a progam in python which is sufficiently large . so i want to stop the execution of the program now . how can i do this? Control-C should work on every operating system. Obviously you have send the Ctrl-C to the

Re: [Tutor] tabbed output

2012-02-12 Thread Hugo Arts
On Mon, Feb 13, 2012 at 1:52 AM, Michael Lewis wrote: > I am having a weird issue. I have a print statement that will give me > multiple outputs separated by a tab; however, sometimes there is a tab > between the output and sometimes there is not. It seems sort of sporadic. My > code is below and

Re: [Tutor] tabbed output

2012-02-12 Thread Modulok
On 2/12/12, Michael Lewis wrote: > I am having a weird issue. I have a print statement that will give me > multiple outputs separated by a tab; however, sometimes there is a tab > between the output and sometimes there is not. It seems sort of sporadic. > My code is below and two sample outputs ar