On Aug 12, 2014 3:29 PM, "keith papa" wrote:
>
> Hi, am a newbie to python and I wondering if you guys can give me some
exercise to work on. I have learned: print function , if function ,
strings, variables, and raw_input. The more the better
Checkio.org is a game made of python coding challenges
Keith,
This should get you started...
http://learnpythonthehardway.org/book/
http://www.codecademy.com/en/tracks/python
http://docs.python-guide.org/en/latest/intro/learning/
Happy coding!
--Greg
On Tue, Aug 12, 2014 at 1:52 PM, keith papa wrote:
> Hi, am a newbie to python and I wonderin
Hi Keith,
It depends on what you want to do with Python in the end (by the
way, if statement is not a function).
Here are some of my suggestions (based on current topics and
things to come later):
1. Write a loop which prints even numbers from 1 to 100.
2. Write a program which determines
Hi Keith,
As a follow-up: I'm sure others might have mentioned this, but I
also recommend doing exercises presented in the book or reference
you're using to learn Python.
Cheers,
Joseph
- Original Message -
From: keith papa Hi, am a newbie to python and I wondering if you guys can give
On Tue, Aug 12, 2014 at 1:52 PM, keith papa wrote:
> Hi, am a newbie to python and I wondering if you guys can give me some
> exercise to work on. I have learned: print function , if function , strings,
> variables, and raw_input. The more the better
Do you find yourself doing certain kinds of co
> So this call will always try to round None(the default return value)
> And of course it produces no output since it prints nothing.
>
> Are you sure that's actually what is in the book?
No. That's very much why I wanted a reference to the original source
of the problem.
Scott attributed too m
On 01/04/14 02:07, Scott W Dunning wrote:
I’m working on a few exercises and I’m a little stuck on this one.
This is what the book has but it just gives me an endless loop.
def square_root(a, eps=1e-6):
while True:
print x
y = (x + a/x) / 2
Scott W Dunning Wrote in message:
> Iâm working on a few exercises and Iâm a little stuck on this one.
>
> This is what the book has but it just gives me an endless loop.
>
> def square_root(a, eps=1e-6):
> while True:
> print x
> y = (x + a/x) / 2
>
On 01/04/2014 02:47, Danny Yoo wrote:
On Mar 31, 2014 6:22 PM, "Scott W Dunning" mailto:scott@cox.net>> wrote:
>
> I’m working on a few exercises and I’m a little stuck on this one.
>
> This is what the book has but it just gives me an endless loop.
>
> def square_root(a, eps=1e-6):
>
On Mar 31, 2014, at 7:10 PM, Danny Yoo wrote:
Thanks for the info Danny! I’ll try that and I should be able to figure it out
with your help!
The book I was referring to is greentreepress.
___
Tutor maillist - Tutor@python.org
To unsubscribe or c
On Mon, Mar 31, 2014 at 8:48 PM, Scott W Dunning wrote:
>
> On Mar 31, 2014, at 7:10 PM, Danny Yoo wrote:
> Thanks for the info Danny! I’ll try that and I should be able to figure it
> out with your help!
>
> The book I was referring to is greentreepress.
The reason I'm asking is I want to do
> I tweaked it to what I thought was correct but when I test it I get nothing
> back.
>
> def square_root(a, eps=1e-6):
>x = a/2.0
>while True:
>y = (x + a/x)/2.0
>if abs(x - y) < eps:
>return y
>x = y
>
> round(square_root(9))
>
> The way I tweaked it s
Also, which book?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On Mar 31, 2014 6:22 PM, "Scott W Dunning" wrote:
>
> I’m working on a few exercises and I’m a little stuck on this one.
>
> This is what the book has but it just gives me an endless loop.
>
> def square_root(a, eps=1e-6):
> while True:
> print x
> y = (x +
> return {e for (e, g) in self.sort_email.items()
> if g & groups_list}
>
guys i think ive got it. The & in that comprehension was really
confusing me, but i found out it means intersection, so i took the
sets manually and saw the results i got using intersection and it
became more
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
On Thu, Feb 9, 2012 at 2:23 PM, Tonu Mikk wrote:
>
>
> On Mon, Feb 6, 2012 at 12:58 PM, Dave Angel wrote:
>>
>> On 02/06/2012 01:24 PM, Tonu Mikk wrote:
>>>
>>> Now I get an error: NameError: global name 'self' is not define.
>>>
>>> Tonu
>>>
>>>
>> Put your remarks after the stuff you quote. Y
On 02/09/2012 02:23 PM, Tonu Mikk wrote:
On Mon, Feb 6, 2012 at 12:58 PM, Dave Angel wrote:
On 02/06/2012 01:24 PM, Tonu Mikk wrote:
Now I get an error: NameError: global name 'self' is not define.
Tonu
Put your remarks after the stuff you quote. You're top-posting, which
makes the r
On Mon, Feb 6, 2012 at 12:58 PM, Dave Angel wrote:
> On 02/06/2012 01:24 PM, Tonu Mikk wrote:
>
>> Now I get an error: NameError: global name 'self' is not define.
>>
>> Tonu
>>
>>
>> Put your remarks after the stuff you quote. You're top-posting, which
> makes the reply difficult to follow.
>
On 02/06/2012 01:24 PM, Tonu Mikk wrote:
Now I get an error: NameError: global name 'self' is not define.
Tonu
Put your remarks after the stuff you quote. You're top-posting, which
makes the reply difficult to follow.
Use copy/paste to describe an error message. You retyped the one above
Now I get an error: NameError: global name 'self' is not define.
Tonu
On Mon, Feb 6, 2012 at 10:19 AM, Nate Lastname wrote:
> Hey Tonu,
>
> The problem is that in your statement definition, you are not
> including the self argument. Your definition needs to be something
> like:
> def dolt(sel
On 06/02/12 16:12, Tonu Mikk wrote:
Alan, thanks for explaining about passing objects to classes. This is
an important concept for me to understand.
I tried running the code, but run into an error that I could not resolve:
TypeError: doIt() takes no arguments (1 given).
Sorry the code was on
Hey Tonu,
The problem is that in your statement definition, you are not
including the self argument. Your definition needs to be something
like:
def dolt(self):
# Do stuff.
For more info on the self keyword, see
http://docs.python.org/tutorial/classes.html, section 9.3.2.
On 2/6/12, Tonu Mikk
Alan, thanks for explaining about passing objects to classes. This is an
important concept for me to understand.
I tried running the code, but run into an error that I could not resolve:
TypeError: doIt() takes no arguments (1 given).
Tonu
On Thu, Feb 2, 2012 at 7:09 PM, Alan Gauld wrote:
> O
On 02/02/12 17:36, Tonu Mikk wrote:
So far I have searched for info on how to pass variables from one class
to another and have been able to create a small two class program
(attached). But I seem unable to generalize from here and apply this
to the game exercise. What would you suggest for m
On Feb 2, 2012, at 12:36, Tonu Mikk wrote:
> I feel stumped and don't know how to go about creating this game with two
> classes.
>
> So far I have searched for info on how to pass variables from one class to
> another and have been able to create a small two class program (attached).
> Tha
>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 we are asked to create another version
Elwin Estle wrote:
I seem to remember that Python (is it supposed to be capitalized? Official
logo is in lower case)
The official logo of Apple doesn't even have an "A" in it, but we don't
spell the company "pple" :)
By long-standing convention and practice, the programming language is
s
"michael scott" wrote
don't need a person walking me through it, a simple, "build a
program that asks
a user to give you a name and create permutations of it" is great.
Of course
that example is elementary, but that is the gist of the responses
I'm looking
for.
So have you done it yet?
An
> [...] I'm finding that I
> understand concepts, but have no real way to implement them.
>
> So now my problem emerges... can anyone give me suggestions of exercises I
> should do to help improve my knowledge of what I can "actually" do with the
> concepts I have.
michael,
first of all, welcom
Okay, here's another one. I started this geez...30 years ago? On a Texas
Instruments 99/4A computer. I've never gotten around to doing anything further
with the idea.
It was a game called "Piledriver". The idea was that in a distant future,
energy demands had become so great that there were
For me, the quickest way to jump into a programming language was seeing
a current open source project and say "I wish it did this too, or that
instead ..." and implement it myself. Not only do you learn about the
project itself, and pick up some tips and tricks along the way, you then
also have
Well, I'm a noob myself, so perhaps take what I say with a grain or three of
salt. On the other hand, I have sort of the opposite problem, lots of ideas,
but not the time nor skill to make them happen.
Do you even necessarily have to complete a project? Sometimes just making an
attempt can te
On 01/22/2011 03:09 PM, David Hutto wrote:
When I felt I was ready to start doing some work, I got involved in an open
source project. It's definitely an experience! Try going through
http://freshmeat.net/
Isn't that for those that aren't given real apprenticeship?:)
Programming is my hobby,
> I just have no idea of what kind of programs to build,
Some of the stock answers for this question are:
http://projecteuler.net/
http://www.pythonchallenge.com/
I usually suggest porting one of the old games in:
http://www.atariarchives.org/basicgames/
Alan
___
On Sat, Jan 22, 2011 at 3:02 PM, Corey Richardson wrote:
> On 01/22/2011 11:56 AM, michael scott wrote:
>>
>> I am new to programming, I intend to get an entry level job programming
>> next year (or a little bit longer). I am switching fields and not going
>> to college, but kinda "self teaching"
On 01/22/2011 11:56 AM, michael scott wrote:
I am new to programming, I intend to get an entry level job programming
next year (or a little bit longer). I am switching fields and not going
to college, but kinda "self teaching" myself through various methods. I
currently understand concepts in pro
Date: Tue, 7 Sep 2010 00:52:38 -0700
From: alan.ga...@btinternet.com
Subject: Re: [Tutor] exercise correct ??
To: rwob...@hotmail.com; tutor@python.org
Oke, the 4 is a starting point for the index.
Next problem.
The begin looks like this :
index_of(5, (1, 2, 4, 5, 6, 10, 5, 5
Oke, the 4 is a starting point for the index.
>
>Next problem.
>
>The begin looks like this :
>
> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)
>
>But in the module I get this result :
>
>val = 5
>seq = (1, 2, 4, 5, 6, 10, 5, 5
>
>So the 4 is not avaible anymore.
>
Yes it is. It is the start par
the header to index(val, seq, start=0) to index (val, seq,
start)
But I think that's not what the exercise wants.
Is there another way I can use the 4 ?
Roelof
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Mon, 6 Sep 2010 23:28:22 +0100
> Su
"Roelof Wobben" wrote
#
def index_of(val, seq, start=0):
"""
>>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)
6
"""
But I get this message :
Failed example:
index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)
Expected:
6
Got:
3
#
But in that tuple 5 is
On 6 September 2010 21:45, Sander Sweers wrote:
>> Is the exercise here wrong ?
>
> Looks like it, or it's a typo.
Now that I had a better look the test is correct. Now it is up to you
to figure out why your index_of() fails. Walter gave you a good hint.
Greets
Sander
___
On 6 September 2010 22:28, Roelof Wobben wrote:
> As far as I know index is not a part of tuple so I have to convert it to a
> list so I can use index.
As of version 2.6/3 a tuple does have index(). Not sure which version
you are using.
Greets
Sander
_
> Date: Mon, 6 Sep 2010 21:45:17 +0200
> Subject: Re: [Tutor] exercise correct ??
> From: sander.swe...@gmail.com
> To: rwob...@hotmail.com
> CC: tutor@python.org
>
> On 6 September 2010 19:32, Roelof Wobben wrote:
> > def index_of(val, seq, start=0):
> >
Hi Roelof,
On 6 September 2010 18:32, Roelof Wobben wrote:
>>>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)
> 6
>
> But in that tuple 5 is on position 3.
>
> Is the exercise here wrong ?
>
>
Not neccesarily... I notice that the call is similar to the previous test
case, but has an
On 6 September 2010 19:32, Roelof Wobben wrote:
> def index_of(val, seq, start=0):
> """
> >>> index_of(9, [1, 7, 11, 9, 10])
> 3
> >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5))
> 3
> >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4)
> 6
> >>> index_of('y', '
"Dave Angel" wrote
while teller < len(u):
getal1 = u[teller] + v[teller]
uitkomst = uitkomst + str(getal1)
But then I get a list of string instead of integers.
You're close. Now that you've initialized the result variable to
[], you can use + just as you're doing. Just
Roelof Wobben wrote:
Date: Fri, 27 Aug 2010 14:27:34 -0400
From: da...@ieee.org
To: rwob...@hotmail.com
CC: alan.ga...@btinternet.com; tutor@python.org
Subject: Re: [Tutor] exercise problem
The other problem is you're confusing the variables inside the function
with the ones dec
We are close to the solution, keep trying!
On 27/08/2010 19.56, Roelof Wobben wrote:
Hello,
Now I have this :
def add_vectors(u, v):
"""
>>> add_vectors([1, 0], [1, 1])
[2, 1]
>>> add_vectors([1, 2], [1, 4])
[2, 6]
>>> add_vectors([1, 2, 1], [1, 4, 3])
[2, 6, 4]
>>> add_vectors([11, 0, -4,
> Date: Fri, 27 Aug 2010 14:27:34 -0400
> From: da...@ieee.org
> To: rwob...@hotmail.com
> CC: alan.ga...@btinternet.com; tutor@python.org
> Subject: Re: [Tutor] exercise problem
>
> (Don't top-post, it loses all the context)
>
> Roelof Wobben wrote:
> &g
(Don't top-post, it loses all the context)
Roelof Wobben wrote:
Hello,
Now I have this :
def add_vectors(u, v):
"""
>>> add_vectors([1, 0], [1, 1])
[2, 1]
>>> add_vectors([1, 2], [1, 4])
[2, 6]
>>> add_vectors([1, 2, 1], [1, 4, 3])
[2, 6, 4]
e.
Roelof
Date: Fri, 27 Aug 2010 10:19:30 -0700
From: alan.ga...@btinternet.com
Subject: Re: [Tutor] exercise problem
To: rwob...@hotmail.com
>u v, result
first example.
u : [1.0] v: [1,1] result [2.1]
OK, Great, you got that.
first split u en v in only numbers.
No, you shoul
Roelof Wobben wrote on 08/27/2010 12:18:01 PM:
>
>
> > Date: Fri, 27 Aug 2010 12:00:23 -0400
> > From: bgai...@gmail.com
> > To: rwob...@hotmail.com
> > CC: tutor@python.org
> > Subject: Re: [Tutor] exercise problem
> >
> > I have been reading yo
On 27/08/2010 17.05, Roelof Wobben wrote:
Hello,
My first try :
def add_vectors(u, v):
"""
>>> add_vectors([1, 0], [1, 1])
[2, 1]
>>> add_vectors([1, 2], [1, 4])
[2, 6]
>>> add_vectors([1, 2, 1], [1, 4, 3])
[2, 6, 4]
>>> add_vectors([11, 0, -4, 5], [2, -4, 17, 0])
[13, -4, 13, 5]
"""
teller
> Date: Fri, 27 Aug 2010 12:00:23 -0400
> From: bgai...@gmail.com
> To: rwob...@hotmail.com
> CC: tutor@python.org
> Subject: Re: [Tutor] exercise problem
>
> I have been reading your posts and responses. I find myself frustrated
> with your lack of understanding of
I have been reading your posts and responses. I find myself frustrated
with your lack of understanding of Python fundamentals and the time and
energy others are putting in that seems to help only a little.
I recommend you take a very basic tutorial, and be sure you understand
the basic concep
Hi Roelof,
See below
On 27 August 2010 16:05, Roelof Wobben wrote:
>
> uitkomst = add_vectors[u,v]
>
> But now I get this error message :
>
>
> Traceback (most recent call last):
> *File "C:\Users\wobben\workspace\oefeningen\src\test.py", line 27, in
> *
>
> uitkomst = add_vectors[u,v]
>
> Type
#x27;function' object is not subscriptable
So it seems that I can't use vectors as a variable in a function.
Roelof
From: rwob...@hotmail.com
To: tutor@python.org
Subject: RE: [Tutor] exercise problem
Date: Fri, 27 Aug 2010 14:38:23 +
Oke,
That's also
; Date: Sat, 28 Aug 2010 00:15:15 +1000
> Subject: Re: [Tutor] exercise problem
>
> On Fri, 27 Aug 2010 08:23:06 pm Roelof Wobben wrote:
> > > > Write a function add_vectors(u, v) that takes two lists of
> > > > numbers
> [...]
> > My new idea is that u i
On Fri, 27 Aug 2010 08:23:06 pm Roelof Wobben wrote:
> > > Write a function add_vectors(u, v) that takes two lists of
> > > numbers
[...]
> My new idea is that u is the number which must be calculated and v is
> the vector which containts the outcome or u is the outcome of the
> first numbers and v
On 27/08/2010 12.23, Roelof Wobben wrote:
From: rwob...@hotmail.com
To: alan.ga...@btinternet.com
Subject: RE: [Tutor] exercise problem
Date: Fri, 27 Aug 2010 07:04:39 +
> To: tutor@python.org
> From: a
From: rwob...@hotmail.com
To: alan.ga...@btinternet.com
Subject: RE: [Tutor] exercise problem
Date: Fri, 27 Aug 2010 07:04:39 +
> To: tutor@python.org
> From: alan.ga...@btinternet.com
> Date: Thu, 26 Aug 2010 23:54:19 +0100
> Subject: Re: [Tutor] exercise problem
"Roelof Wobben" wrote
Write a function add_vectors(u, v) that takes two lists of numbers
I think that u is the name of the new list and v is the number which
represent the number which must be eveluated.
No. It sounds like you don't really understand the basic concepts
behind functions yet
On 8/26/2010 12:02 PM Roelof Wobben said...
Hello,
I have this exercise:
Lists can be used to represent mathematical vectors. In this exercise and
several that follow you will write functions to perform standard operations on
vectors. Create a file named vectors.py and write Python code to m
> I confused things by my mistake in the specifications.
>
> The criterion for exiting the outer loop is that
>
> mpylist[0][1] * mult[0] + mpylist[1][1] * mult[1] + mpylist[2][1] *
> mult[2]
> + . . .
>
> be > zlim.
Can you try rewriting the spec correctly, because I'm still not
sure I understan
From: Alan Gauld
Date: 08/09/06 03:30:28
To: Kermit Rose; tutor@python.org
Subject: Re: [Tutor] Exercise in writing a python function.
> The current specifications for the function are:
>
> def incr(mult,z,zlim,mpylist):
> # mult is a vector of exponents for the multiplier
> The current specifications for the function are:
>
> def incr(mult,z,zlim,mpylist):
> # mult is a vector of exponents for the multipliers in mpylist.
> # z is a positive odd integer.
> # zlim is the upper bound critical value for the sum of (
> mpylist[k][0] *
> mpylist[k][1] )
Just to clari
On 09/08/06, Kermit Rose <[EMAIL PROTECTED]> wrote:
> Hello John.
>
> Thanks for replying.
>
> In my previous version, I used z as the critical value,.
>
> Since I created zlim, a function of z, to be passed in as a parameter, I no
> longer need z
>
> in the parameter list.
>
> In another part of
On 09/08/06, Kermit Rose <[EMAIL PROTECTED]> wrote:
> def incr(mult,z,zlim,mpylist):
> # mult is a vector of exponents for the multipliers in mpylist.
> # z is a positive odd integer.
> # zlim is the upper bound critical value for the sum of ( mpylist[k][0] *
> mpylist[k][1] )
> # where kth mult
69 matches
Mail list logo