The code I wrote is supposed to ask the user to enter a number;
Then tell the user what's going to happen to that number (x / 2 + 5) ;
Then give the user an answer;
I succeeded getting results from even numbers, but when I try diving an uneven
number (i.e. 5) by 2, I get only the whole number
On Sun, Dec 30, 2012 at 5:37 PM, Alvaro Lacerda alacerda...@gmail.comwrote:
The code I wrote is supposed to ask the user to enter a number;
Then tell the user what's going to happen to that number (x / 2 + 5) ;
Then give the user an answer;
Try x / 2.5 + 5
I succeeded getting results from
On 30-12-2012 23:37, Alvaro Lacerda wrote:
I'm trying to get full number result using the %d command
Try %f instead. %d is the formatting symbol for integer numbers.
See http://docs.python.org/2/library/stdtypes.html#string-formatting-operations
Or have a look at what string.format() can do:
2012/12/30 Alvaro Lacerda alacerda...@gmail.com:
The code I wrote is supposed to ask the user to enter a number;
Then tell the user what's going to happen to that number (x / 2 + 5) ;
Then give the user an answer;
I succeeded getting results from even numbers, but when I try diving an
Alvaro Lacerda wrote:
The code I wrote is supposed to ask the user to enter a number;
Then tell the user what's going to happen to that number (x / 2 + 5) ;
Then give the user an answer;
I succeeded getting results from even numbers, but when I try diving an
uneven number (i.e. 5) by 2, I
Hello,
Python does not support REAL numbers. It has float number, which
are approximations of real numbers. They behave almost, but not
quite, like you might expect.
It also has Decimal numbers. They also approximate real numbers,
but slightly differently. They might behave more like you'd
%s got the job done!!!
Thank you all for the info and links,
I appreciate it!
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
code files? What's the regular expression for
locating a number with an arbitrary number of digits
seperated into an arbitrary number of blocks of an
arbitray number of digits with an arbitrary number
of whitespace characters between each block?
Gabriel Genellina wrote:
En Tue, 24 Jul 2007 11:10:53 -0300, Stargaming [EMAIL PROTECTED]
escribió:
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
There are various things I like about the D language that I think Python
too may enjoy. Here are few bits (mostly syntactical
Steven D'Aprano [EMAIL PROTECTED] writes:
Propose:
123 456 789 = 123456789
123.456 789 = 123.456789
+1
--
http://mail.python.org/mailman/listinfo/python-list
Sorry for the slow feedback.
StargamingSounds like a good thing to be but the arbitrary
positioning doesnt make any sense.
The arbitrary positioning allows you to denote 4-digit groups too in
binary/hex literals, like in my example:
auto x = 0b0100_0011;
Stargamingfits into the current
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
The str.split method has no bearing on this discussion,
It most certainly does. To make '123 456' into an integer,
you split it and then join it.
Indeed. Which has nothing to do with the Python syntax for creating a
numeric literal in code.
--
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
So, just as
int('123' '456')
123456
is not an error, the proposal is that
a = 123 456
SyntaxError: invalid syntax
will not be an error either.
More directly: Just as these three statements create the same literal
value:
100 ten
thousands.)
Raymond is correct in that Japan traditionally groups in fours (and stills
reads it that way regardless, as shown above), but in an ordinary
programming context, this almost never comes into play.
On the original topic of the thread, I personally like the underscore idea
from
On Jul 26, 12:18 am, Ben Finney [EMAIL PROTECTED]
wrote:
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
IDLE 1.2c1
s = '123 456'
s.split()
['123', '456']
The str.split method has no bearing on this discussion,
It most certainly does. To make '123 456' into an integer,
you split it and
On Jul 24, 10:10 am, Stargaming [EMAIL PROTECTED] wrote:
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
There are various things I like about the D language that I think Python
too may enjoy. Here are few bits (mostly syntactical ones):
1) (we have discussed part of this in the
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
On Jul 25, 8:54?pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
Any number of whitespace characters? Just spaces or all whitespace
characters?
What about searching source code files? What's the regular
expression for locating a number with an
On Jul 25, 7:22 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
On Jul 24, 6:08 pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
On Tue, 24 Jul 2007 20:09:00 +0200, Bjoern Schliessmann wrote:
Stargaming wrote:
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
While in a syntax
On 26/07/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
The str.split method has no bearing on this discussion,
It most certainly does. To make '123 456' into an integer,
you split it and then join it.
z = '123 456'
y = z.split()
x = ''.join(y)
w = int(x)
w
123456
but it
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
On Jul 25, 9:04?pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
Why does it make no sense? Have you never had to scrape a web page
or read a CSV file?
Again, unrelated to the way the Python compiler syntactically treats
the source code.
So this
On Jul 26, 1:24 am, Ben Finney [EMAIL PROTECTED]
wrote:
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
On Jul 25, 9:04?pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
Why does it make no sense? Have you never had to scrape a web page
or read a CSV file?
Again, unrelated to the way the Python
On Jul 25, 1:08 am, Steven D'Aprano
[EMAIL PROTECTED] wrote:
Underscores in numerics are UGLY. Why not take a leaf out of implicit
string concatenation and allow numeric literals to implicitly concatenate?
Python already does:
hello- world = hello-world
Propose:
123 456 789 = 123456789
Steven D'Aprano wrote:
Python already does:
hello- world = hello-world
Propose:
123 456 789 = 123456789
123.456 789 = 123.456789
I second that!
/W
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 24, 6:08 pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
On Tue, 24 Jul 2007 20:09:00 +0200, Bjoern Schliessmann wrote:
Stargaming wrote:
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
While in a syntax like:
for i in xrange(1_000_000):
my eyes help me group them at
On Jul 25, 1:22 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
So, spaces will no longer be delimiters? Won't that cause
much wailing and gnashing of teeth?
I can't think of a circumstance in which
48 1906
is valid, so . . .
I like it, too :)
--
Star Weaver
--
On Wed, 25 Jul 2007 18:17:19 -0700, [EMAIL PROTECTED] wrote:
On Jul 25, 8:00 pm, Ben Finney [EMAIL PROTECTED]
wrote:
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
On Jul 24, 6:08 pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
Python already does:
hello- world = hello-world
Propose:
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
On Jul 24, 6:08 pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
Python already does:
hello- world = hello-world
Propose:
123 456 789 = 123456789
123.456 789 = 123.456789
So, spaces will no longer be delimiters?
I don't see how you get
On Wed, 25 Jul 2007 10:22:46 -0700, [EMAIL PROTECTED] wrote:
On Jul 24, 6:08 pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
On Tue, 24 Jul 2007 20:09:00 +0200, Bjoern Schliessmann wrote:
Stargaming wrote:
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
While in a syntax like:
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
IDLE 1.2c1
s = '123 456'
s.split()
['123', '456']
The str.split method has no bearing on this discussion, which is about
the Python language syntax, and numeric literal values in particular.
--
\Pinky, are you pondering what I'm
On Jul 25, 8:00 pm, Ben Finney [EMAIL PROTECTED]
wrote:
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
On Jul 24, 6:08 pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
Python already does:
hello- world = hello-world
Propose:
123 456 789 = 123456789
123.456 789 = 123.456789
So,
On Jul 25, 8:54?pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
On Wed, 25 Jul 2007 10:22:46 -0700, [EMAIL PROTECTED] wrote:
On Jul 24, 6:08 pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
On Tue, 24 Jul 2007 20:09:00 +0200, Bjoern Schliessmann wrote:
Stargaming wrote:
On Tue, 24 Jul 2007
On Wed, 25 Jul 2007 10:47:33 -0700, Paddy wrote:
But then,what would _0 be, the number 0 or the name _0 analagous to
a0
Of course the name because numbers have to start with a digit or a dot.
Otherwise this would break backwards compatibility.
Ciao,
Marc 'BlackJack' Rintsch
--
On Jul 25, 1:47 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Tue, 24 Jul 2007 11:10:53 -0300, Stargaming [EMAIL PROTECTED]
escribió:
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
There are various things I like about the D language that I think Python
too may enjoy. Here
On Jul 25, 9:04?pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
On Wed, 25 Jul 2007 18:17:19 -0700, [EMAIL PROTECTED] wrote:
On Jul 25, 8:00 pm, Ben Finney [EMAIL PROTECTED]
wrote:
[EMAIL PROTECTED] [EMAIL PROTECTED] writes:
On Jul 24, 6:08 pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
There are various things I like about the D language that I think
Python too may enjoy. Here are few bits (mostly syntactical ones):
1) (we have discussed part of this in the past) You can put
underscores inside number literals, like 1_000_000, the compiler
doesn't enforce the position of such
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
There are various things I like about the D language that I think Python
too may enjoy. Here are few bits (mostly syntactical ones):
1) (we have discussed part of this in the past) You can put underscores
inside number literals, like
Stargaming wrote:
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
While in a syntax like:
for i in xrange(1_000_000):
my eyes help me group them at once.
Sounds like a good thing to be but the arbitrary positioning
doesnt make any sense.
Checking underscore positions would
On Tue, 24 Jul 2007 20:09:00 +0200, Bjoern Schliessmann wrote:
Stargaming wrote:
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
While in a syntax like:
for i in xrange(1_000_000):
my eyes help me group them at once.
Sounds like a good thing to be but the arbitrary
On Jul 24, 5:19 am, [EMAIL PROTECTED] wrote:
There are various things I like about the D language that I think
Python too may enjoy. Here are few bits (mostly syntactical ones):
1) (we have discussed part of this in the past) You can put
underscores inside number literals, like 1_000_000, the
En Tue, 24 Jul 2007 11:10:53 -0300, Stargaming [EMAIL PROTECTED]
escribió:
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
There are various things I like about the D language that I think Python
too may enjoy. Here are few bits (mostly syntactical ones):
1) (we have discussed
40 matches
Mail list logo