Hi,
Another way to execute your program is to open up your file with
gedit, and on the very first line type (sans quotes) "#!/usr/bin/env
python" by itself and save it. Then, go to the terminal like Michael
said, and cd into the directory with your file. Type "chmod 0700
your-program.py" at the
Somewhere in the start menu, you'll be able to open a terminal. It
might be called GTerm, Gnome Term, xterm, or any number of things with
"term" in the name.
Once you've done that, you need to see if python is in your path. Do
that by typing python in the terminal. If you enter the python shell,
y
Hi
I am new to python programming and also the linux enviroment most of my
skills are windows based and programming skills is visual basics. I decided
that it would be a great start and new direction for me to learn python and
at the same time linux. However I have already run into a wall, and any
On 9/26/07, Christopher Spears <[EMAIL PROTECTED]> wrote:
>
> I'm working on a problem in Chapter 5 of Core Python
> Programming(2nd Edition). I am supposed to write a
> script that take an opening balance and a monthly
> payment from the user. The script then displays the
> balance and payments
Ok as I see it, it's should go like this:
Print 'Think of a number between 1 and 100, and let me guess it'
Type1 = input ('Type 1 if I am high')
Type2 = input ('Type 2 if I am low')
Type3 = input ('Type 3 if I am dead on')
I can't seem to get the guts of it. I assume that there are 3 if stat
Chris wrote:
> Guess the number from the user using 1,2,3 keys
> Ask the user if # is high, low, or dead on.
> Print 'you got it' when Python gets it.
>
> As you can see I need help. I've given you the pseudo code.
OK, how about some real code? If we write the program for you
Jeff Peery wrote:
> hello,
>
> I have a question about the pickler. I'm using it to save objects in a
> program of mine that I can later reload to use. I was wondering how the
> pickle works and how it references the class module when I unpickle the
> pickled objects. for example I save some o
Ok, in this case the guessing game is design to guess the number (0-100)
that the user holds in his head.
I assume that Python off the bat Python gives a first guess.
Example:
I guess 50 #(using the split range)
Depending on the user # Python asks:
Press 1 if I am high.
Press 2 if I am low.
Pr
I'm working on a problem in Chapter 5 of Core Python
Programming(2nd Edition). I am supposed to write a
script that take an opening balance and a monthly
payment from the user. The script then displays the
balance and payments like so:
Enter opening balance: 100
Enter monthly payment: 16.13
h!!! You posted in HTML and top posted! OH NO! I top-posted too!
""" runs away screaming and bouncing off the walls like Daffy Duck """
_
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Fiyawerx
Sent: Tuesday, September 25, 2007 6:45 PM
To: Darren Williams
Cc
It also seems, for people like me, I've learned a lot of 'what not to do' by
seeing peoples replies to others posts telling them.. well, what not to do.
If all these were taken 'off list' you'd have a whole lot more people doing
bad things because they wouldn't have seen yet not to do it, not to me
>
> The 'print' statement is hardcoded to add a space between elements.
> print is meant to make output easy, at the cost of control.
Well, that was a good example. I had prepared Notes for myself also along the
same lines.
print and softspace in python
In python, whenever you use >>>print sta
hello,
I have a question about the pickler. I'm using it to save objects in a
program of mine that I can later reload to use. I was wondering how the pickle
works and how it references the class module when I unpickle the pickled
objects. for example I save some objects using the pickler,
On 9/26/07, Terry Carroll <[EMAIL PROTECTED]> wrote:
>
> On Tue, 25 Sep 2007, Ian Witham wrote:
>
> def numfaczeroes(n):
> """
> return the count of trailing zeroes from n!
> e.g., 10! = 3628800; count of trailing zeros = 2
> """
> exponent = 1
> fivecount = 0
> while (n
On 9/26/07, Terry Carroll <[EMAIL PROTECTED]> wrote:
>
> On Wed, 26 Sep 2007, Ian Witham wrote:
>
> > My solution still took over 5 seconds on the Sphere Judge machine.
>
> How much data are they throwing at you? For the sample data they provide
> on the website, your first "slow" solution finishe
On Wed, 26 Sep 2007, Ian Witham wrote:
> My solution still took over 5 seconds on the Sphere Judge machine.
How much data are they throwing at you? For the sample data they provide
on the website, your first "slow" solution finished on my machine almost
instantaneously.
_
>
>
> from itertools import count, takewhile
>
> def numfaczeroes2(n):
> def while_(e):
> return n//(5**e) > 0
> return sum(n//(5**exponent) for exponent in takewhile(while_,
> count(1)))
>
>
> It is quite a bit slower, though; probably because of the extra function
> call introd
All jokes aside now (glad you took it that way Mike). Maybe I havn't gave
the tutor enough attention, but I have never witnessed someone jump down
anothers throat because they posted in all caps, didn't enter a subject
etc... etc... The one time I have seen an argument (well heated debate) was
Noufal Ibrahim wrote:
> I suppose you could also do but it's a little less readable
> print "%sand this %sneeds to check %s"%tuple([str(x) for x in
> (val1,val2,val3)])
The %s formatter takes care of the string conversion, the list
comprehension is not needed. Just use
print "%sand this %sneed
I agree with Kent...
--
Michael Langford
Phone: 404-386-0495
Consulting: http://www.TierOneDesign.com/
Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com
On 9/25/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> Hansen, Mike wrote:
> > Anytime someone posts in HTML, or posts without a s
Tim wrote:
> Hello,
> I have a print statement where I use concatenation of variables with "+" to
> avoid extra whitespaces. The variables are mixed (float/int).
>
> How can I convert them all to strings to have a clean print statement?
>
> example
> print str(var1)+"and this "+str(var2)+"needs t
Hansen, Mike wrote:
> Anytime someone posts in HTML, or posts without a subject, or
> accidentally
> hijacks a thread, or top-posts, or writes in caps, a couple of posters
> pop up
> and complain. Rather than posting to the entire list, I think it'd be
> best if
> you send your complaint directly t
林培恒 wrote:
> On Mon, 24 Sep 2007, Terry Carroll write:
>
>> My math is rusty. Is there a concept of "greater than"
>> or "largest" in complex numbers on different axis? Which
>> is larger, 4+2i or 2+4i?
>
> In fact, complex numbers can not compare directly. People always compare
> complex numbe
So by your own rules, you should have sent that to the offending user(s).
- Original Message -
From: "Hansen, Mike" <[EMAIL PROTECTED]>
To: "python tutor"
Sent: Tuesday, September 25, 2007 2:27 PM
Subject: [Tutor] Take if offline
> Anytime someone posts in HTML, or posts without a subj
Anytime someone posts in HTML, or posts without a subject, or
accidentally
hijacks a thread, or top-posts, or writes in caps, a couple of posters
pop up
and complain. Rather than posting to the entire list, I think it'd be
best if
you send your complaint directly to the "offending" user. I'd prefer
Tim wrote:
> Hello,
> I have a print statement where I use concatenation of variables with "+" to
> avoid extra whitespaces. The variables are mixed (float/int).
>
> How can I convert them all to strings to have a clean print statement?
>
> example
> print str(var1)+"and this "+str(var2)+"needs t
Excerpt from an email Danny Yoo sent to me and the list in 2005. I had the
same question. ;-)
Hi Tom,
The 'print' statement is hardcoded to add a space between elements.
print is meant to make output easy, at the cost of control.
If we need more fine-grained control over output, we may want t
Hello,
I have a print statement where I use concatenation of variables with "+" to
avoid extra whitespaces. The variables are mixed (float/int).
How can I convert them all to strings to have a clean print statement?
example
print str(var1)+"and this "+str(var2)+"needs to check "+str(var3)
how ca
Terry Carroll wrote:
> On Tue, 25 Sep 2007, Ian Witham wrote:
>
>> As I was using a list comprehension I wasn't sure how to make the
>> calculations stop when the result of integer division == 0.
>
> I don't see how to do that, either. Someone on this list (sorry, I forget
> who) once suggested
On Tue, 25 Sep 2007, Ian Witham wrote:
> As I was using a list comprehension I wasn't sure how to make the
> calculations stop when the result of integer division == 0.
I don't see how to do that, either. Someone on this list (sorry, I forget
who) once suggested that the list comprehension shou
On Tue, 25 Sep 2007, John Fouhy wrote:
> You've got upper and lower bounds - maybe you could do a binary search
> to find the max exactly? It should only take the same number of steps
> again...
I thought of that; and then I thought I'd rather go home and have dinner.
___
On Mon, 24 Sep 2007, Terry Carroll write:
>My math is rusty. Is there a concept of "greater than"
>or "largest" in complex numbers on different axis? Which
>is larger, 4+2i or 2+4i?
In fact, complex numbers can not compare directly. People always compare
complex numbers with their 'model'. For
Terry,
I liked your answer!
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 9/25/07, Chris <[EMAIL PROTECTED]> wrote:
> I have this GUESSING GAME code found below:
> -
> import random
> number = random.randint(1, 101)
> print "I've thought of a number between 1 and 100."
> print "Try and guess it!"
> print
> guess = input( "What's your guess? ")
> wh
You've got upper and lower bounds - maybe you could do a binary search
to find the max exactly? It should only take the same number of steps
again...
On 9/25/07, Terry Carroll <[EMAIL PROTECTED]> wrote:
> On Mon, 24 Sep 2007, Christopher Spears wrote:
>
> > How can I find the largest float and com
35 matches
Mail list logo