On 8 March 2012 19:18, John Jensen wrote:
>
> From: Steven D'Aprano
> To: tutor@python.org
> Sent: Thursday, March 8, 2012 7:51:33 AM
> Subject: Re: [Tutor] Tuple - Immutable ?
>
> col speed wrote:
>
>> I was just thinking a
On 8 March 2012 18:51, Steven D'Aprano wrote:
> col speed wrote:
>
>> I was just thinking about the immutability of things and tried this
>> (which -at least I- find interesting:
>>
>>>>> id(1)
>>
>> 154579120
>>>>>
On 8 March 2012 18:27, Walter Prins wrote:
> Just to add, notice that even for lists,
>
> l = l + [7,8,9]
>
> produces a new list, while
>
> l += [7,8,9]
>
> does not.
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription op
On 8 March 2012 18:11, Sudip Bhattacharya wrote:
s=(1,2,3)
s=s+(4,5,6)
s
> (1,2,3,4,5,6)
>
> The tuple has changed.
>
> I thought I read that tuples are sequences (like lists), but they are
> immutable - They can't be changed once created. Could someone explain please
> ?
I'm just a
On 8 March 2012 01:11, Dave Angel wrote:
> On 03/07/2012 12:07 AM, col speed wrote:
>>
>>
>>
>> Then we have:
>>
>>
>>>>> a = tuple(range(10))
>>>>> b = tuple(reversed(a))
>>>>> any(a) in b
>>
>
On 7 March 2012 11:50, Mark Lawrence wrote:
> On 07/03/2012 04:36, col speed wrote:
>>
>> On 7 March 2012 10:45, Mark Lawrence wrote:
>>>
>>> On 07/03/2012 03:24, col speed wrote:
>
>> I *think* I understand:
>> Where it says:
>> "For
On 7 March 2012 10:45, Mark Lawrence wrote:
> On 07/03/2012 03:24, col speed wrote:
>>
>> Hello again
>> Hope you are all well.
>>
>> I'm trying to make a "match 3" game, where you have a square grid and
>> have to put 3 matching shapes in a
Hello again
Hope you are all well.
I'm trying to make a "match 3" game, where you have a square grid and
have to put 3 matching shapes in a row.
I need a function that tells me if the game is playable, ie. it is
possible to match 3 shapes by only swapping 2 adjacent shapes.
I have looked at the co
I'm not sure in windows, but in Linux, press Ctrl_C
On 29 February 2012 21:33, Debashish Saha wrote:
>
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
_
On 4 February 2012 20:29, Zafrullah Syed wrote:
> Hi,
>
> I need urgent help:
Yes, I think you do.
Take notice of the last replies.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/list
On 11 January 2012 20:11, Max S. wrote:
> I believe that line 3 raises an error. The because you contained the text
> in single quotes, and then used the same character in 'you're not chris',
> Python believes that you are trying to type "you" re not chris". You can
> change the single quotes su
> your_weight = int(raw_input("Please enter your weight: "))
> if your_weight < 0:
> print 'You're not Chris!'
> elif your_weight == 170:
> print 'You might be Chris! But...'
> your_height = int(raw_input("Please enter your height: "))
> if your_height < 180:
>
> That's exactly the point.
> Very few people know about maketrans before they take the Python Challenge.
>
> But that's the whole point of the challenge, as you go through it you will
> discover new and powerful tools in the Python library that save you from
> having to invent your own. (Look out
On 20 December 2011 03:00, Joaquim Santos wrote:
> Hi list!
>
> This is my first post here but I've been following the list for some time
> now! I know that recently there was a message about decryption and all. I
> think that was what made me go back into the Python challenge and try to
> solve s
On 17 December 2011 16:49, Peter Otten <__pete...@web.de> wrote:
> col speed wrote:
>
>> If anyone has the time, please have a look at the attached text file
>> and let me know any comments on how to improve it.
>
> At first glance the code looks good. I think you ca
On 17 December 2011 16:40, Dave Angel wrote:
> On 12/16/2011 03:29 AM, col speed wrote:
>>
>> If anyone has the time, please have a look at the attached text file
>> and let me know any comments on how to improve it.
>> Thanks a lot
>> Col
>>
> I don
If anyone has the time, please have a look at the attached text file
and let me know any comments on how to improve it.
Thanks a lot
Col
#!usr/bin/env python
# title - baccarat2.py
import random
class Player(object):
"""simple Player object that
keeps tabs on bets and kitty"""
def
<--> snip
>> if point(one+two) == "win":
>>
>
> Here you go into the function "point" the first time. Inside the function
> you are in an infinite while-loop where you only exit if the sum is either 7
> ("lose") or equal the given parameter ("win"). Then you compare the return
> value. In
On 9 October 2011 13:17, Andreas Perstinger wrote:
> On 2011-10-09 07:16, col speed wrote:
>
>> The part of the script that is causing the problem is as follows:
>>
>> def point(num):
>> while True:
>> raw_input("Roll")
>>
Hi again, Once more I've come up with a problem I can't explain. It must be
something simple, but I can't work it out.
The part of the script that is causing the problem is as follows:
def point(num):
while True:
raw_input("Roll")
uno, dos = random.choice(dice), random.choice(
On 5 July 2011 07:15, wrote:
> I second this.
>
> I have a second harddrive with Mint on it. Ithought it might be fun to
> learn emacs. On windows I've been using eclipse for like 6 to 12 months or
> however long ago I started.
>
> I tried emacs for about two seconds and was like, uh no thanks. D
and?
On 21 June 2011 14:38, David Merrick wrote:
> I need help using Class methods in another class. I have a class called
> Critter and I want to create two critters in a farm Class Farm and use
> Class Critter's methods
>
> --
> Dave Merrick
>
> merrick...@gmail.com
>
> Ph 03 3423 121
> Cel
2011/6/19 Válas Péter
> Each time I send a message to this list, I get an autoreply like this. No,
> I won't add myself to any stupid guestlists to use a public list. Could a
> list moderator please show this user the exit?
>
> -- Továbbított levél --
> Feladó:
> Dátum: 2011. jún
On 19 June 2011 14:46, Lisi wrote:
> On Sunday 19 June 2011 08:39:43 Alan Gauld wrote:
> > "Lisi" wrote
> >
> > > It does indeed. Thank you, both of you. I have clearly not got the
> > > terms
> > > command, method, function (and feature?) clearly sorted out in my
> > > mind, so
> > > that is
I think this is easily seen by a for loop:
for something in range(20):
print something
In the above "something" is a variable, in this case an int(which is
immutable). However, "something" is changed every time it goes through the
loop.
It's the equivalent of:
x = 0
x = 1
x = 2
and so on
Just
On 27 May 2011 17:31, Walter Prins wrote:
>
>
> I find this thread very interesting.
>
I've been learning Python on and off for the past 3 years, as a hobby.
I am over 50 years old, so will never be a programmer. However:
1/ I've done a bit in Project Euler and have found many algorithms to get
On 8 April 2011 15:54, Jan Erik Moström wrote:
> Hi,
>
> A couple of my students need to be able to play sounds, controlling start &
> stop, play sound from files and if possible generate sinus wave sounds.
>
> I looked around and found several packages but they all seem to have some
> kind platf
I am a newbie too, but
from collections import defaultdict
Then you can do:
data = defaultdict(int)
Everything (all keys) start at 0, so you can do "+=" with no problem.
I'm sure somebody else has a better solution though!
Cheers
Colin
On 25 March 2011 18:52, Robert Sjoblom wrote:
> Hi ag
On 8 February 2011 16:20, tee chwee liong wrote:
> hi all,
>
> >i have a function which returns a string. for eg: X='101110'. i want to
> search for 0 and highlight the location.
> i> am thinking of defining X as a list. but how can i split 101110 as there
> are no spaces in between? i'm thinkin
You're missing a "." that if your computer is the same as mine, looks like
something left behind by a mosquito
On 1 February 2011 18:33, Karim wrote:
>
> Hello,
>
> >>> "He is {what}".format(what="{wild}")
> 'He is {wild}'
>
> Regards
> Karim
>
>
> On 02/01/2011 09:44 AM, Becky Mcquilling wrote:
You can always change the precision in decimal. Just an idea
On 31 January 2011 22:23, Richard D. Moores wrote:
>
> Which is accurate to only 16 digits; my Windows Vista calculator gives
> 2.9231329473018093516404474158812 for 23.45**.34
>
> And using mpmath with Python 2.6 does exactly as p
On 12 December 2010 07:10, Al Stern wrote:
> This was another execise in my book. Following is my code for a program
> that uses dictionaries to find and edit pairs of fathers and sons. The
> program works right up to the final step which is to find out if any given
> father is actually a grand
--> snip
>However, even with countWords2, which is supposed to overcome this
>problem, it feels as if I've entered an infinite loop.
>Josep M.
Just my twopenneth, I'm a noob and I'm not going to try such a big file on
my old machine, but:
1. Maybe create a *set* from the wordlist, loop through
>
> --
>
> Message: 2
> Date: Tue, 09 Nov 2010 12:35:26 +0100
> From: Stefan Behnel
> To: tutor@python.org
> Subject: Re: [Tutor] List comprehension question
> Message-ID:
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Richard D. Moores, 09.11.2010 12:07:
>
> Message: 7
> Date: Fri, 22 Oct 2010 21:48:29 -0700
> From: "Richard D. Moores"
> To: "Steven D'Aprano"
> Cc: tutor@python.org
> Subject: Re: [Tutor] What does "TypeError: 'int' object is not
>iterable" mean?
> Message-ID:
>
>
> >
> Content-Type: text/plain; charset=UTF-
Message: 6
Date: Tue, 28 Sep 2010 13:15:26 +0700
From: col speed
To: tutor@python.org
Subject: [Tutor] Pythonic nested lists
Message-ID:
Content-Type: text/plain; charset="iso-8859-1"
Hi all,
I've been trying to write a programme that solves sudoku problems for a
while n
Hi all,
I've been trying to write a programme that solves sudoku problems for a
while now. I'm getting close, but would like to ask a few questions about
the most pythonic way of doing some things.
I've decided to create nested lists (row order, column order and square
order) which correspond with
On 7 July 2010 18:59, Evert Rol wrote:
> > The second number should be negative ( I WANT it to be negative). For
> example:
> >
> > print (0 - t[4])*(t[3] - t[5]) , (0 - t[5])*(t[2] - t[4]) gives :
> >
> > -30895 -935636
> >
> > And in the python shell:
> >
> > >>> -30895 -935636
> > -966531
>
I apologise in advance for such a silly question. Normally, I start to write
to the list and work the answer out before sending the mail. Not this time.
I'm trying to work out which triangles contain the cartesian origin (0, 0)
and have the following:
t = [-340, 495, -153, -910, 835, -947]
print
HI Guys,
I have a small programme, called shop.py, that I wish to make into a
"frozen binary" ( I think that's right - I'm using Linux Ubuntu 9.04
and I want the programme to work on a windows computer that doesn't
have Python installed).
I used freeze.py from examples/Tools and everything seemed
e sense.
Thanks again
Colin
2009/1/29 John Fouhy
> 2009/1/29 col speed :
> [...]
> > What I expected "mult" to do was (somehow)to work out what the powers
> of
> > the prime factors would be. Another reason I didn't think it was "mul" is
> >
28 Jan 2009 08:29:09 -
From: "Alan Gauld"
Subject: Re: [Tutor] operator, mult
To: tutor@python.org
Message-ID:
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original
"col speed" wrote
> I got the following function while go
That's what I thought , but I tried it to no avail. Plus the syntax is
wrong.
Thanks anyway
Colin
2009/1/28 John Fouhy
> 2009/1/28 col speed :
> > Hello there,
> > I got the following function while googling:
> >
> > def totient(n):
> > ""&qu
Hello there,
I got the following function while googling:
def totient(n):
"""calculate Euler's totient function.
If [[p_0,m_0], [p_1,m_1], ... ] is a prime factorization of 'n',
then the totient function phi(n) is given by:
(p_0 - 1)*p_0**(m_0-1) * (p_1 - 1)*p_1**(m_1-1) * .
Wow! I seem to have caused a great deal of comments!
I actually am looking to see if a number is a "perfect cube". I will try out
all the suggestions.
Thanks a lot.
Colin
P.S.
I have a small programme that changes decimal to binary (I don't know if it
can be changed to work with fractions or not),
Hi there, just a quick one.
Is there a way to obtain cube roots in python?
I have been trying:
math.pow(n,1.0/3)
This works with some, but with 64, for example I get:
>>> pow(64,1.0/3)
3.9996
However:
>>> 4**3
64
Any ideas?
Thanks
Colin
___
Tu
wrote:
>
>> On Tue, Dec 23, 2008 at 8:20 PM, col speed wrote:
>>
>>
>>
>>> I've written a "division" function that gives more decimal places than
>>> the
>>> one already in python. What my poor old brain can't work
Hello there, I am learning python as a hobby in my spare time. I enjoy doing
"project euler", not that I am any good at maths, but it gives me problems
to solve in python!
Please Note: I do not expect (or want) you to give me the solution, if you
could just point me in the right direction - that wo
48 matches
Mail list logo