Michael Langford wrote:
> Inheritance: Syntactic sugar that's not really needed to make a well
> organized system. Often overused, especially by programmers in big
> companies, beginning students of programmers, green engineers, and
> professors. In practice hides a lot of data, often making behav
There is definitely a secondary understanding of math that comes from
working on computers. How computers do math is quite a bit different from
how you or I do it on a piece of paper. The fact that python can do
arbitrary large integer arithmetic makes it quite nice for many math
applications as yo
As Michael points out, you need to explicitly use the round function, as the
float formatting merely truncates anything after the second decimal place.
I ran across a similar problem with the int() fuction early on. Anything
after the decimal point is truncated, not rounded, leading to behavior I
Emad Nawfal wrote:
> *Hi All Tutors,*
> *I'm new and I'm trying to use unicode strings in my code (specifically
> Arabic), but I get this:*
>
> IDLE 1.2.1
text = ur'المصريون'
> Unsupported characters in input
This seems to be a problem with IDLE rather than Python itself. This
message:
http
* Alan Gauld <[EMAIL PROTECTED]> [2007-09-17 18:54:43]:
> If you go with the flow rather than trying to make the flow
> go the way you want life is easier.
Insightful. QOTW. :-)
--
O.R.Senthil Kumaran
http://uthcode.sarovar.org
___
Tutor maillist -
This function can easily found using the google programming rule:
I want a function that does 'action'
Type: into google
Look in top 5 results. If that doesn't work, try synonyms for 'action'
--Michael
PS: The function you're looking for is called round. Its first param is the
number to
I wrote a script that takes a price and a sales tax
and calculates the new price.
#!/usr/bin/env python
def calculate_price(price, percent_tax):
sales_tax = price * percent_tax
new_price = price + sales_tax
return new_price
price = float(raw_input("Enter a price: "))
percent_tax = fl
> "Place the following three in order: Inheritance, Polymorphism,
Encapsulation."
Inheritance: Syntactic sugar that's not really needed to make a well
organized system. Often overused, especially by programmers in big
companies, beginning students of programmers, green engineers, and
professors. I
Stephen Nelson-Smith wrote:
> Hello friends,
>
> Over lunch today some colleagues discussed a question they are using
> as a conversation starter in some preliminary chats in our developer
> hiring process.
>
> The question was:
>
> "Place the following three in order: Inheritance, Polymorphism,
On 9/19/07, Stephen Nelson-Smith <[EMAIL PROTECTED]> wrote:
>
>
> "Place the following three in order: Inheritance, Polymorphism,
> Encapsulation."
>
> They specifically did not define in *what* order, leaving that for
> the answerer to decide.
>
I would place them in alphabetical order.
BTW, the
*Hi All Tutors,*
*I'm new and I'm trying to use unicode strings in my code (specifically
Arabic), but I get this:*
IDLE 1.2.1
>>> text = ur'المصريون'
Unsupported characters in input
>>> for letter in text:
print letter
Traceback (most recent call last):
File "", line 1, in
for letter i
Hello friends,
Over lunch today some colleagues discussed a question they are using
as a conversation starter in some preliminary chats in our developer
hiring process.
The question was:
"Place the following three in order: Inheritance, Polymorphism, Encapsulation."
They specifically did not de
On Tuesday 18 September 2007 04:06, Varsha Purohit wrote:
> I wanted a link or tutorial to help me understand how to read
> or write ascii text file in python. with and without using Numpy.
If you want to save a Numpy array as a text file, goto this web-page:
http://www.scipy.org/Numpy_Examp
Luke Paireepinart wrote:
> Remember how people are always saying "don't use the string module
> unless necessary because string objects have most of the functionality
> built-in now"
> This is another case of that.
I think this advice is being a little overstated in this thread. The
string modu
"Andrew Nelsen" <[EMAIL PROTECTED]> wrote
> But I was guessing there was an easier way (There was.). I'm
> actually
> working through this one site called http://www.pythonchallenge.com.
> Seems
> like a nifty way to learn a little more python.
If you are doing the challenge then take a look a
"Andrew Nelsen" <[EMAIL PROTECTED]> wrote
>I was wondering, recently, the most expedient way to take a string
>with
> [EMAIL PROTECTED]&*] and alpha-numeric characters [ie. "[EMAIL
> PROTECTED]@*$g@)$&^@&^$F"]
> and
> place all of the letters in a string or list. I thought there could
> be
>
"Christopher Spears" <[EMAIL PROTECTED]> wrote
>I wrote a simple calculator script:
>
> #!/usr/bin/python env
>
> def calculator(n1, operator, n2):
>f1 = float(n1)
>f2 = float(n2)
You probably shouldn't do this since it forces all
your results to be floats even if the two arguments
a
"Varsha Purohit" <[EMAIL PROTECTED]> wrote
> I wanted a link or tutorial to help me understand how to read
> or write
> ascii text file in python. with and without using Numpy. If you have
> any
> example that would also help me understand better.
Almost any tutorial will show you how to
18 matches
Mail list logo