Hi
I am a newbie to python and am trying to write a program that does a
sum of squares of numbers whose squares are odd.
For example, for x from 1 to 100, it generates 165 as an output (sum
of 1,9,25,49,81)
Here is the code I have
print reduce(lambda x, y: x+y, filter(lambda x: x%2, map(lambda x
On Sunday, April 7, 2013 9:16:27 PM UTC+10, ReviewBoard User wrote:
Hi
I am a newbie to python and am trying to write a program that does a
sum of squares of numbers whose squares are odd.
For example, for x from 1 to 100, it generates 165 as an output (sum
of 1,9,25,49,81
On 04/07/2013 07:16 AM, ReviewBoard User wrote:
Hi
I am a newbie to python
Then why are you trying to do 7 or 8 things on one line?
and am trying to write a program that does a
sum of squares of numbers whose squares are odd.
For example, for x from 1 to 100, it generates 165 as an output
I am a newbie to python
Welcome! I hope you'll do great things with Python.
and am trying to write a program that does a
sum of squares of numbers whose squares are odd.
OK.
For example, for x from 1 to 100, it generates 165 as an output (sum
of 1,9,25,49,81)
I don't follow, you seem
On Apr 7, 4:16 pm, ReviewBoard User lalitha.viswan...@gmail.com
wrote:
Hi
I am a newbie to python and am trying to write a program that does a
sum of squares of numbers whose squares are odd.
For example, for x from 1 to 100, it generates 165 as an output (sum
of 1,9,25,49,81)
Here
On 07/04/13 20:09, Dennis Lee Bieber wrote:
On Sun, 7 Apr 2013 04:16:27 -0700 (PDT), ReviewBoard User
lalitha.viswan...@gmail.com declaimed the following in
gmane.comp.python.general:
Hi
I am a newbie to python and am trying to write a program that does a
sum of squares of numbers whose
On 7 April 2013 20:23, Ian Foote i...@feete.org wrote:
I'm surprised no one has suggested:
import math
sum( x*x for x in range(1, int(math.sqrt(100)), 2))
Yeah! And I'm surprised no one came up with:
from itertools import count, takewhile
sum(takewhile((100).__gt__, filter((2).__rmod__,
I can't even read that mess... three nested lambda?
I have to say this and other answers in this thread seem not that friendly to
me.
The OP said it's a newbie question, we should be more welcoming to newcomers.
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 07 Apr 2013 04:16:27 -0700, ReviewBoard User wrote:
Hi
I am a newbie to python and am trying to write a program that does a sum
of squares of numbers whose squares are odd. For example, for x from 1
to 100, it generates 165 as an output (sum of 1,9,25,49,81)
Here is the code I have
Test.py
#!/usr/bin/python
from my_lib import my_function
class my_class(my_function.name):
def __initial__(self, name);
pass
def test():
print this is a test
If __name__ == '__maim__':
my_class.main()
---
my_lib.py
class
On Fri, Oct 14, 2011 at 11:20 PM, aaabb...@hotmail.com wrote:
Test.py
#!/usr/bin/python
from my_lib import my_function
class my_class(my_function.name):
Why are you subclassing my_function.name and not just my_function?
def __initial__(self, name);
pass
The initializer method
On Sat, Oct 15, 2011 at 2:20 AM, aaabb...@hotmail.com wrote:
Test.py
#!/usr/bin/python
from my_lib import my_function
class my_class(my_function.name):
Classes must inherit from other classes -- not variables or functions.
def __initial__(self, name);
This should be def
On Sat, Oct 15, 2011 at 12:09 AM, Jason Swails jason.swa...@gmail.com wrote:
snip
For instance, let's say you want to deal with shapes. You can define a
shape via a class
class Shape(object):
Base shape class
snip
Now we get into inheritance. Let's suppose that we want a specific type
On 10月15日, 上午12时04分, Chris Rebert c...@rebertia.com wrote:
On Fri, Oct 14, 2011 at 11:20 PM, aaabb...@hotmail.com wrote:
Test.py
#!/usr/bin/python
from my_lib import test
class my_class(my_function.name):
Why are you subclassing my_function.name and not just my_function?
try to inherit
On Sat, Oct 15, 2011 at 12:59 AM, aaabb...@hotmail.com wrote:
On 10月15日, 上午12时04分, Chris Rebert c...@rebertia.com wrote:
On Fri, Oct 14, 2011 at 11:20 PM, aaabb...@hotmail.com wrote:
snip
my_class.main()
Your class doesn't define any method named main (you only defined
test() and
On Oct 15, 2:20 am, aaabb...@hotmail.com wrote:
Test.py
---
#!/usr/bin/python
from my_lib import my_function
class MyClass(my_function): # usually class names start capital
We know you're not forgetting to document.
def __init__(self, name):
super(MyClass,
I want to start python, I have just downloaded python compiler, Can
somebody please tell me what python really is and explain its
architecture, in what problems it is used and from where should I
start?
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Oct 24, 2010 at 12:29 AM, Hrishikesh hrishikesh...@gmail.com wrote:
I want to start python, I have just downloaded python compiler,
Most consider it an interpreter (though it does compile the source
code into high-level bytecode).
Can
somebody please tell me what python really is
A
Hrishikesh hrishikesh...@gmail.com writes:
I want to start python, I have just downloaded python compiler, Can
somebody please tell me what python really is and explain its
architecture, in what problems it is used and from where should I
start?
I would start by looking at
On Oct 24, 12:48 am, Arnaud Delobelle arno...@gmail.com wrote:
Hrishikesh hrishikesh...@gmail.com writes:
I want to start python, I have just downloaded python compiler, Can
somebody please tell me what python really is and explain its
architecture, in what problems it is used and from
Hrishikesh hrishikesh...@gmail.com writes:
Thanks guys,
I knew its an interpreter, mistakenly put compiler [...]
Oops! You just started a flame war ;)
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 10/24/2010 3:29 AM, Hrishikesh wrote:
I want to start python, I have just downloaded python compiler, Can
somebody please tell me what python really is and explain its
architecture, in what problems it is used and from where should I
start?
If you don't know the answers to *any* of those
On Oct 24, 7:31 am, Steve Holden st...@holdenweb.com wrote:
On 10/24/2010 3:29 AM, Hrishikesh wrote:
I want to start python, I have just downloaded python compiler, Can
somebody please tell me what python really is and explain its
architecture, in what problems it is used and from where
On 10/24/2010 5:19 PM, rantingrick wrote:
On Oct 24, 7:31 am, Steve Holden st...@holdenweb.com wrote:
On 10/24/2010 3:29 AM, Hrishikesh wrote:
I want to start python, I have just downloaded python compiler, Can
somebody please tell me what python really is and explain its
architecture, in
On Mar 8, 8:15 pm, BobAalsma bob.aal...@aalsmacons.nl wrote:
I'm on Mac OS X 10.5.8 and downloaded 2.6.4 Mac Installer Disk Image
as/in(?) the sys admin user. For this user Pyhton 2.6.4 is now the
current version.
I want to use Python outside the sys asdmin user. However, all other
users
I'm on Mac OS X 10.5.8 and downloaded 2.6.4 Mac Installer Disk Image
as/in(?) the sys admin user. For this user Pyhton 2.6.4 is now the
current version.
I want to use Python outside the sys asdmin user. However, all other
users still use Python 2.5.1 (Apple delivered).
The sys admin user looks in
I have Heard About Python its a OOD Language. i have to Learn it
where from i should start it.
i have python compiler at linux Platform.
anyone can suggest me about it.
Thanks In advance.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
I have Heard About Python its a OOD Language. i have to Learn it
where from i should start it.
i have python compiler at linux Platform.
anyone can suggest me about it.
Thanks In advance.
How about http://docs.python.org/tut/tut.html?
--
[EMAIL PROTECTED] a écrit :
I have Heard About Python its a OOD Language.
'OOD' = 'object oriented ???' ?
i have to Learn it
where from i should start it.
Err... What about reading the docs on python.org - possibly starting
with the tutorial:
http://docs.python.org/tut/tut.html
You'll
: Re: Newbie In Python
[EMAIL PROTECTED] a écrit :
I have Heard About Python its a OOD Language.
'OOD' = 'object oriented ???' ?
i have to Learn it
where from i should start it.
Err... What about reading the docs on python.org - possibly starting
with the tutorial:
http
On May 20, 5:15 am, [EMAIL PROTECTED] wrote:
I have Heard About Python its a OOD Language. i have to Learn it
where from i should start it.
i have python compiler at linux Platform.
anyone can suggest me about it.
Thanks In advance.
I recommend Pyscripter
In article [EMAIL PROTECTED],
Gary Herron [EMAIL PROTECTED] wrote:
With Python, you can program with a smile on your face.
+1 QOTW
(Truly, when I found Python, programming became fun again.)
Again? Looking back over the years, after I learned Python I realized
that I never really had
[EMAIL PROTECTED] a écrit :
Hi,
i was reading/learning some hello world program in python.
I think its very simillar to Java/C++/C#.
Err... You saw a Python helloworld and a Java helloworld and you found
them very similar ???
What's different (except
syntax) ?
dynamism (and not only
pistacchio a écrit :
(snip)
Technically speaking, it (Python) is not, for example, strongly
typed,
You're confusing strong typing with static typing. Somewhat orthogonal
issues.
--
http://mail.python.org/mailman/listinfo/python-list
On May 8, 7:25 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
Hi,
i was reading/learning some hello world program in python.
I think its very simillar to Java/C++/C#. What's different (except
syntax) ?
All the languages have similar power, in a theoretical sense. If
you can solve a problem
I sincerely think that most languages in existence today have its place.
Java has some great libraries and programs that were written in it. Try
writing an Eclipse clone in Python, I don't think it would go well.
On Fri, May 9, 2008 at 11:08 AM, hdante [EMAIL PROTECTED] wrote:
On May 8, 7:25
write working programs
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Behalf Of [EMAIL PROTECTED]
Sent: Thursday, May 08, 2008 6:25 AM
To: python-list@python.org
Subject: Newbie to python --- why should i learn !
Hi,
i was reading/learning some hello
In article [EMAIL PROTECTED],
maxinbjohn [EMAIL PROTECTED] wrote:
Hi Raxit,
One of the the tempting features of Python is that it is fun to code
in Python. If you are really trying to learn python, you should read
Adventures with Neko (http://gnuvision.com/books/pybook/) . It is an
introductory
On 2008-05-08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi,
i was reading/learning some hello world program in python.
I think its very simillar to Java/C++/C#. What's different (except
syntax) ?
Yes, and all programs that people write typically look like the hello world
program.
Look at
On May 8, 5:25 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
Hi,
i was reading/learning some hello world program in python.
I think its very simillar to Java/C++/C#. What's different (except
syntax) ?
what can i do easily with python which is not easy in c++/java !?
Are you a newbie
[EMAIL PROTECTED] ha scritto:
Hi,
i was reading/learning some hello world program in python.
I think its very simillar to Java/C++/C#. What's different (except
syntax) ?
well, it's similar in the sense that it is a programming language. So
you can say that assembly is similar to BASIC, but
Hi Raxit,
One of the the tempting features of Python is that it is fun to code
in Python. If you are really trying to learn python, you should read
Adventures with Neko (http://gnuvision.com/books/pybook/) . It is an
introductory book on Python programming for school children by Mr.
Pramode CE.
pls dont learn it
Move on
The world is full enough of 9 to 5 coders
Mark From: [EMAIL PROTECTED] Subject: Newbie to python --- why should i learn
! Date: Thu, 8 May 2008 03:25:17 -0700 To: python-list@python.org Hi, i
was reading/learning some hello world program in python. I think its
C#
using System;
namespace HelloWorld
{
Class HelloWorld
{
static void Main(String[] args)
{
Console.WriteLine(Hello World);
}
}
}
--
http://mail.python.org/mailman/listinfo/python-list
hello,
I have programmed co insidentally in all the 3 languages.
so out of my experience of 10 + years, I got my personal share of
reasons to prefer python over the other 2 namely c++ and java.
firstly as every one has already explained, python is easy, fun to
learn and can do many things much
On Thu, May 8, 2008 at 7:25 AM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Hi,
i was reading/learning some hello world program in python.
I think its very simillar to Java/C++/C#. What's different (except
syntax) ?
what can i do easily with python which is not easy in c++/java !?
On Thu, 08 May 2008 04:17:01 -0700, s0suk3 wrote:
Are you a newbie to Python, or to programming in general? I'll assume
you are a newbie to programming in general because of that last
question you asked. Things in Python are easier than in almost any
other programming language. Here are three
Marc 'BlackJack' Rintsch ha scritto:
On Thu, 08 May 2008 04:17:01 -0700, s0suk3 wrote:
Are you a newbie to Python, or to programming in general? I'll assume
you are a newbie to programming in general because of that last
question you asked. Things in Python are easier than in almost any
other
On Thu, 08 May 2008 15:49:01 +0200, pistacchio wrote:
Marc 'BlackJack' Rintsch ha scritto:
On Thu, 08 May 2008 04:17:01 -0700, s0suk3 wrote:
Are you a newbie to Python, or to programming in general? I'll assume
you are a newbie to programming in general because of that last
question you
[EMAIL PROTECTED] wrote:
Hi,
i was reading/learning some hello world program in python.
I think its very simillar to Java/C++/C#. What's different (except
syntax) ?
what can i do easily with python which is not easy in c++/java !?
With Python, you can program with a smile on your face.
On Thu, May 8, 2008 at 6:25 AM, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
Hi,
i was reading/learning some hello world program in python.
I think its very simillar to Java/C++/C#. What's different (except
syntax) ?
what can i do easily with python which is not easy in c++/java !?
Python
pistacchio [EMAIL PROTECTED] writes:
ocalm forces you to di OOP
Ocaml *allows* you to do OOP. It's very much an optional feature of
the language, just like for Python.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 21, 5:52 am, [EMAIL PROTECTED] wrote:
Hi anyone
I'm very interesed to learn python and really willing to do so,but
unfortunately dont know where to start, or what programs need to
install to start.
Can someone help me to get in the right track, and get a good move?
Thanks for all
-On [20080221 11:56], [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:
Can someone help me to get in the right track, and get a good move?
http://wiki.python.org/moin/BeginnersGuide
--
Jeroen Ruigrok van der Werven asmodai(-at-)in-nomine.org / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
Can someone help me to get in the right track, and get a good move?
http://wiki.python.org/moin/BeginnersGuide
http://www.diveintopython.org/
--
http://mail.python.org/mailman/listinfo/python-list
Hi anyone
I'm very interesed to learn python and really willing to do so,but
unfortunately dont know where to start, or what programs need to
install to start.
Can someone help me to get in the right track, and get a good move?
Thanks for all help
pls reply on
[EMAIL PROTECTED]
or
[EMAIL
[EMAIL PROTECTED] wrote:
Hi anyone
I'm very interesed to learn python and really willing to do so,but
unfortunately dont know where to start, or what programs need to
install to start.
Can someone help me to get in the right track, and get a good move?
Thanks for all help
If you're a
Dive into Python is a very good book but it's for people who have
experience in other languages. I liked the book.
Whatever book you read, please take a look at the Python Tutorial:
http://docs.python.org/tut/tut.html, it will help.
regards,
Subeen.
http://love-python.blogspot.com/
On Feb 21,
A big help for 'easily learning python was and is
Learning Python
(a book written by Mark Lutz)
after having studied this book you are able to think in python
another book I like very much is
Core Python Programming
(written by Wesley Chun)
regards
michael
On Thursday 21 February 2008
[EMAIL PROTECTED] wrote:
I'm very interesed to learn python and really willing to do so,but
unfortunately dont know where to start, or what programs need to
install to start.
There are several good replies already on this thread, but in case any
experienced programmers searching the Google
madzientist a écrit :
hi,
two quick questions:
a) i am using SPE (latest version) and for some reason, when i type,
say
if 1==2:
print not equal
else:
print equal
the else is at the same indentation level as the preceding print
statement, and i get a syntax error
madzientist wrote:
hi,
two quick questions:
a) i am using SPE (latest version) and for some reason, when i type,
say
if 1==2:
print not equal
else:
print equal
the else is at the same indentation level as the preceding print
statement, and i get a syntax error
On Sep 10, 11:24 pm, madzientist [EMAIL PROTECTED] wrote:
hi,
two quick questions:
a) i am using SPE (latest version) and for some reason, when i type,
say
if 1==2:
print not equal
else:
print equal
the else is at the same indentation level as the preceding print
-Original Message-
From: [EMAIL PROTECTED]
[mailto:python-
[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, September 11, 2007 8:26 AM
To: python-list@python.org
Subject: Re: newbie: stani's python editor if-else
On Sep 10, 11:24 pm, madzientist [EMAIL PROTECTED
[EMAIL PROTECTED] schrieb:
I agree with Steve. I have yet to see an IDE for Python (or anything
else) that unindents statements. Even IDLE, the Official IDE for
Python, doesn't do that.
emacs in python-mode
Just hit TAB and it unindents else in the given example.
Hit TAB again and it cylces
Hamilton, William wrote:
-Original Message-
From: [EMAIL PROTECTED]
[mailto:python-
[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, September 11, 2007 8:26 AM
To: python-list@python.org
Subject: Re: newbie: stani's python editor if-else
On Sep 10, 11:24 pm
Steve Holden a écrit :
madzientist wrote:
hi,
two quick questions:
a) i am using SPE (latest version) and for some reason, when i type,
say
if 1==2:
print not equal
else:
print equal
the else is at the same indentation level as the preceding print
statement, and i
Thanks, everybody, for the very very useful and kind responses.
There is a second reason why I asked the question about automatic de-
indenting. I am teaching myself Python partly so I can then help my
technically astute, but blind friend learn programming. For the many
reasons that Pythonistas
madzientist schrieb:
Is Python a bad choice for the blind programmer, as a result of a
tight linkage between visual aspects of the code and its function ? I
wish the site blindprogramming.com weren't so lifeless...
There was a thread regarding blind people and python indentation shortly:
Thanks, Gregor. Very helpful thread.
Suresh
On Sep 11, 1:26 pm, Gregor Horvath [EMAIL PROTECTED] wrote:
madzientist schrieb:
Is Python a bad choice for the blind programmer, as a result of a
tight linkage between visual aspects of the code and its function ? I
wish the site
hi,
two quick questions:
a) i am using SPE (latest version) and for some reason, when i type,
say
if 1==2:
print not equal
else:
print equal
the else is at the same indentation level as the preceding print
statement, and i get a syntax error
why doesn't spe automatically
Group:
I'm new to python and new to mysql.
I have a csv file that is about 200,000 rows that I want to add to a
mysql database. Yes, I know that I can do this directly from the
mysql command line, but I am doing it through a python script so that
I can munge the data before adding it.
I have
On May 20, 5:55 pm, cjl [EMAIL PROTECTED] wrote:
...snip...
conn = MySQLdb.connect(db=database, host=localhost, user=root,
passwd=password)
c = conn.cursor()
reader = csv.reader(open(sys.argv[1]))
for row in reader:
data1, data2, data3, data4 = row
data = (data1,data2,data3,data4)
cjl wrote:
Group:
I'm new to python and new to mysql.
I have a csv file that is about 200,000 rows that I want to add to a
mysql database. Yes, I know that I can do this directly from the
mysql command line, but I am doing it through a python script so that
I can munge the data before
Michael,
put this at the top of your code. After the window
closes read the testLog.out file. It may give you
a clue as to what is happening.
sys.stdout = open('testLog.out', 'w')
jim-on-linux
http://www.inqvista.com
On Tuesday 21 November 2006 22:20, mkengel wrote:
Caution: newbie
Caution: newbie question
I am using python 2.4.3-11 on Windows XP.
Problem: Python window closes immediately after executing a *.py file
(e.g. containing a print... command.
What do I have to do to keep it open to see the results ?
Interactive window stays open.
Thank you.
Michael
--
mkengel wrote:
Caution: newbie question
If you're pretty sure it's a common newbie question, then begin by
going to the Google repository at:
http://groups.google.com/group/comp.lang.python
Search in the box at upper right, on, say, keep cmd window open, or
keep dos window open.
Like so:
mkengel wrote:
Caution: newbie question
If you're pretty sure it's a common newbie question, then begin by
going to the Google repository at:
http://groups.google.com/group/comp.lang.python
Search in the box at upper right, on, say, keep cmd window open, or
keep dos window open.
Like so:
mkengel wrote:
Problem: Python window closes immediately after executing a *.py file
(e.g. containing a print... command.
What do I have to do to keep it open to see the results ?
Simple scripts that print to a console, or read from it, works best if
you run them from a standard Command
Hello AllI want to import a module I wrote to use it in a script. But, it is not in the same directory as the script I want to import it into. So my solution is to put the following piece of code in the script:import osos.chdir(the direcotry where the module is kept)import the moduleThis generates
izak marais [EMAIL PROTECTED] writes:
I want to import a module I wrote to use it in a script. But, it is
not in the same directory as the script I want to import it into.
I can think of two sensible solutions.
One is to change the 'sys.path' list to include the directory where
you want
On 3/2/06, - C Saha - [EMAIL PROTECTED] wrote:
Hello Python Experts
I am Chirantan, a beginner in python programming world. I have some
programming knowledge in SHELL, BATCH and little bit PERL. I subscribed to
this list with the hope that I will get support and help from all of you.
To
Hello Python ExpertsI am Chirantan, a beginner in python programming world. I have some programming knowledge in SHELL, BATCH and little bit PERL. I subscribed to this list with the hope that I will get support and help from all of you. To start with, I thought it will be a good idea to
Hello,
Here is the script then the problem.
cat testing.py
import crypt
import random, string
def getsalt(chars = string.letters + string.digits):
return random.choice(chars) + random.choice(chars)
username = raw_input('password : ')
print crypt.crypt(username,getsalt())
python
Johhny wrote:
Here is the script then the problem.
cat testing.py
import crypt
import random, string
def getsalt(chars = string.letters + string.digits):
return random.choice(chars) + random.choice(chars)
username = raw_input('password : ')
print crypt.crypt(username,getsalt())
Thankyou, I appreciate your help. I did not realise that python would
behave that way.
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
How do I find out what modules have been included in my python install?
I am having issues with crypt functions not working on ubuntu or redhat
but they work on Slackware.
Any assistance would be great.
Regards,
Johhny.
--
http://mail.python.org/mailman/listinfo/python-list
Il 2005-12-15, [EMAIL PROTECTED] [EMAIL PROTECTED] ha scritto:
How do I find out what modules have been included in my python install?
Look in site-packages directory
I am having issues with crypt functions not working on ubuntu or redhat
but they work on Slackware.
Crypt functions? Are u
Hello,
If I go into the python shell and type help(modules) It does show
that crypt is there. However Im unsure if that means that there is help
or its got the module installed.
From a dpkg --list python* I have
ii python2.4-crypto
2.0+dp1-2ubuntu1
Il 2005-12-15, Johhny [EMAIL PROTECTED] ha scritto:
From a dpkg --list python* I have
ii python2.4-crypto
2.0+dp1-2ubuntu1 cryptographic
algorithms and protocols for Python
Which means it should work. However Im not really getting anything from
it. Which
I have created a python program that takes a flat file and changes some
of the data and create a new flat file with the changes. Part of this
process requires that I try to find a particular model car in an MS Sql
table. This part of the program is now working great.
It has come to my attention
91 matches
Mail list logo