questions anon wrote:
> I am trying to do something really simple.
> I have a numpy array and if any values in the array are 255 I want to
> change them to 1.
> but I can't seem to get anything to work!
Note that numpy is a specialist topic, and for everything but the basics the
numpy mailing li
list1
[['61', '34', '61', '34'], ['61', '35', '61', '70', '61'], ['61',
'70', '61', '34'], ['34', '58', '34', '58']]
>>> weight={}
>>> weight{list1[0]}=1
SyntaxError: invalid syntax
>>> weight[list1[0]]=1
Traceback (most recent call last):
File "", line 1, in
weight[list1[0]]=1
TypeError: u
On 2011/11/17 11:59 AM, lina wrote:
list1
[['61', '34', '61', '34'], ['61', '35', '61', '70', '61'], ['61',
'70', '61', '34'], ['34', '58', '34', '58']]
weight={}
weight{list1[0]}=1
SyntaxError: invalid syntax
weight[list1[0]]=1
Traceback (most recent call last):
File "", line 1, in
w
On Thu, Nov 17, 2011 at 6:09 PM, Christian Witts wrote:
> On 2011/11/17 11:59 AM, lina wrote:
>
> list1
> [['61', '34', '61', '34'], ['61', '35', '61', '70', '61'], ['61',
> '70', '61', '34'], ['34', '58', '34', '58']]
>
> weight={}
> weight{list1[0]}=1
>
> SyntaxError: invalid syntax
>
> weight[l
On 2011/11/17 12:26 PM, lina wrote:
On Thu, Nov 17, 2011 at 6:09 PM, Christian Witts wrote:
On 2011/11/17 11:59 AM, lina wrote:
list1
[['61', '34', '61', '34'], ['61', '35', '61', '70', '61'], ['61',
'70', '61', '34'], ['34', '58', '34', '58']]
weight={}
weight{list1[0]}=1
SyntaxError: inval
Hi All,
I am using Python 2.7, windows Env.
I have an Installer written in Python(45%) and Powershell(55%) which is used to
install Virtual Machines at specific locations. It is single threaded.
I am trying to implement a ProgressBar for this installer. So that the user
will come to know the p
lina wrote:
list1
[['61', '34', '61', '34'], ['61', '35', '61', '70', '61'], ['61',
'70', '61', '34'], ['34', '58', '34', '58']]
You have a list of lists.
weight={}
weight{list1[0]}=1
SyntaxError: invalid syntax
In Python, {} are used for dicts, and in Python 3, sets. They aren't
used fo
Hi all,
I'm new to programming (thus Python), so after reading the basics, I wanted to
practise what I've learnt . I've come across a beginners exercise which is to
programme rot13.
I've written some code but it doesn't seem to work
Here it is:
def rot13(s):char_low = ()result = ""
On Thu, Nov 17, 2011 at 2:14 PM, Nidian Job-Smith wrote:
> Hi all,
>
> I'm new to programming (thus Python), so after reading the
> basics, I wanted to practise what I've learnt . I've come across a
> beginners exercise which is to programme rot13.
>
> I've written some code but it doesn't seem t
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
> sum(1 if type(elem) == list else 0 for elem in list1) not work for you if
> all you want to do is count how
On Thu, Nov 17, 2011 at 8:17 PM, Steven D'Aprano wrote:
> lina wrote:
>>
>> list1
>> [['61', '34', '61', '34'], ['61', '35', '61', '70', '61'], ['61',
>> '70', '61', '34'], ['34', '58', '34', '58']]
>
> You have a list of lists.
>
>
> weight={}
> weight{list1[0]}=1
>>
>> SyntaxError: inval
lina wrote:
May I ask which role the __repr__ plays here?
... weight[elem.__repr__()] += 1
... else:
... weight[elem.__repr__()] = 1
...
You should never call elem.__repr__(), any more than you would call
elem.__len__() or elem.__str__().
(Well, technically there *are* rare u
Nidian Job-Smith wrote:
Hi all,
I'm new to programming (thus Python), so after reading the basics, I wanted to
practise what I've learnt . I've come across a beginners exercise which is to
programme rot13.
I've written some code but it doesn't seem to work
Here it is:
def rot13(s):cha
On 2011/11/17 03:56 PM, lina wrote:
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
sum(1 if type(elem) == list else 0 for elem in list1) not work for you if
all yo
Hi Lina
On 17 November 2011 14:04, lina wrote:
> >> Traceback (most recent call last):
> >> File "", line 1, in
> >>weight[list1[0]]=1
> >> TypeError: unhashable type: 'list'
> >
> > You are trying to store a list as a key inside a dict. This cannot be
> done
> > because lists (like all mu
Thanks for all. Everything new to me is so amazing.
Well, still a remaining question, how to sort based on the value of the key.
Actually I googled hours ago, wanna see more ways of doing it.
Best regards,
>
> On 17 November 2011 14:04, lina wrote:
>>
>> >> Traceback (most recent call last):
>
lina wrote:
You are trying to store a list as a key inside a dict. This cannot be done
because lists (like all mutable types) can't be hashed.
I checked online dictionary, still confused about hashed. is it equal
to mix together or mess together?
Almost.
In ordinary English, a hash is a mix
From: Wayne Werner
Sent: Wednesday, November 16, 2011 8:38 PM
To: Mic
Cc: tutor@python.org
Subject: Re: [Tutor] Clock in tkinter?
On Wed, Nov 16, 2011 at 11:44 AM, Mic wrote:
I wonder if you have any suggestions regarding how to place widgets in my
window.
Even though I try to arran
-Original Message-
From: Shirkhedkar, Dhanashri [mailto:dhanashri.shirkhed...@honeywell.com]
Sent: Wednesday, November 16, 2011 10:58 PM
To: Prasad, Ramit
Subject: RE: binary file query
Thanks for replying.
It means that no need to use the 'Struct' module for binary file read,
right?
===
On Thu, Nov 17, 2011 at 8:57 AM, Mic wrote:
>
>
> Okay, to begin with, I hope I am replying correctly now.
>
Better, though there was quite a lot of my email that you could have
removed.
>
> I wonder, how do I add a background picture to my GUI window?
>
> So far, I thought I could make a l
On Thu, Nov 17, 2011 at 10:44 PM, Steven D'Aprano wrote:
> lina wrote:
>
>>> You are trying to store a list as a key inside a dict. This cannot be
>>> done
>>> because lists (like all mutable types) can't be hashed.
>>
>> I checked online dictionary, still confused about hashed. is it equal
>> to
lina wrote:
Right now I wanna check which are not hash-able, for strings, set, and
tuple (which I don't understand).
Mutable objects are those that can be changed in place: lists, sets,
dicts are all mutable, because you can change them:
>>> mylist = [1, 2, 3]
>>> mylist[1] = 200
>>> print
Hi all,
I'm new to programming (thus Python), so after reading the basics, I wanted to
practise what I've learnt .
I've come across a beginners exercise which is to write the code for rot13.
I've written some code but it doesn't seem to work
When I run it I get this error:
NameError: glo
Sorry about the code format in last E-mail. I'll attach the code in notepad, as
my e-mail doesnt seem to like sending plain text..
> From: nidia...@hotmail.com
> To: st...@pearwood.info; tutor@python.org
> Date: Thu, 17 Nov 2011 17:45:11 +
> Subject:
Nidian Job-Smith wrote:
When I run it I get this error:
NameError: global name 'rot13_char' is not defined
[...]
Any ideas where i'm wrong?
You have a function called "rot13", and *another* function called
"rot13", which will over-write the first one. But you have no function
called "rot
From: Rayon [mailto:ra...@gtt.co.gy]
Sent: 17 November 2011 14:04
To: 'tutor@python.org'
Subject: python telnet
I am trying to use winpexpect to connect a telnet session.
I keep getting this error.
raise ExceptionPexpect, 'Command not found: %s' % self.command
ExceptionPex
On 11/17/2011 12:54 PM, Nidian Job-Smith wrote:
Sorry about the code format in last E-mail. I'll attach the code in notepad, as
my e-mail doesnt seem to like sending plain text..
But attachments aren't visible to everyone on the list, and even when
they are, some people are (rightfully) parano
hi all,keep getting the above error, can't understand or fix it, can anyone
help.
def exchange():euro=1dollar=1.35base=50amount = input ('how
much do you want to change')if amount>base:
totalreturn=amount*dollarelse:print 'not enough'return
totalretur
Post the error stack.
Sent from my BlackBerry wireless device from MTN
-Original Message-
From: ADRIAN KELLY
Sender: tutor-bounces+delegbede=dudupay@python.org
Date: Thu, 17 Nov 2011 18:47:07
To:
Subject: [Tutor] local variable referenced before assignment
On Thu, Nov 17, 2011 at 1:53 PM, wrote:
> Post the error stack.
> Sent from my BlackBerry wireless device from MTN
>
> -Original Message-
> From: ADRIAN KELLY
> Sender: tutor-bounces+delegbede=dudupay@python.org
> Date: Thu, 17 Nov 2011 18:47:07
> To:
> Subject: [Tutor] local variab
On 11/17/2011 01:47 PM, ADRIAN KELLY wrote:
hi all,keep getting the above error, can't understand or fix it, can anyone
help.
def exchange():euro=1dollar=1.35base=50amount = input ('how much
do you want to change')if amount>base:totalreturn=amount*dollar
else:
Steven D'Aprano wrote:
> Immutable objects are those that cannot be changed in place: you have to
> create a new object. Tuples, frozensets, strings, ints, floats are all
> immutable. They are hashable.
Tuples are special: there are hashable and unhashable tuples. To be hashable
all items in a t
If you're going to put a function inside your class (since you're using self in
there, I'm sure that's what you meant to do), you should change it to:
def change_value_the_time(self):
and call it with
self.display_time.after(20, self.change_value_the_time)
But your program also has un
you are spot on. thanks very much i understand the problem now and its
been solved.
very clear help
thanks, adrian
> Date: Thu, 17 Nov 2011 14:01:19 -0500
> From: d...@davea.name
> To: kellyadr...@hotmail.com
> CC: tutor@python.org
> Subject: Re: [Tutor] local variable reference
On Thu, Nov 17, 2011 at 1:17 PM, Mic wrote:
> I have now worked to stop using the global scope and instead put my
> prior global variable into
> the constructor in the class. I believe that I have managed to do that now.
>
> Do you believe that this is correctly done?
>
>
> #Trying putting the_
i have tried everything, i am trying to build in a loop to my 2 functions which
worked fine up until my latest sorti.
please have a look if you can..
def exchange(cash_in):euro=1dollar=1.35base=50if cash_in>base:
totalreturn=cash_in*dollarelse:tota
#i am nearly there guys..please loop at the infinite loop i am getting
here..PLEASE!!#ADRIAN
def exchange(cash_in):euro=1dollar=float(1.35)base=50if
cash_in>base:totalreturn=cash_in*dollarelse:totalreturn=0
return totalreturn
amoun
On Thu, Nov 17, 2011 at 3:19 PM, ADRIAN KELLY wrote:
> i have tried everything, i am trying to build in a loop to my 2 functions
> which worked fine up until my latest sorti.
>
> please have a look if you can..
>
> def exchange(cash_in):
> euro=1
> dollar=1.35
> base=50
>
On Thu, Nov 17, 2011 at 3:29 PM, ADRIAN KELLY wrote:
> def main():
> amount = float(raw_input('how much do you want to change:'))
> while amount<50:
> print 'Sorry, cannot convert an amount under €50 '
>
>
When do you reassign amount?
HTH,
Wayne
___
Where do you intend the variable cash_in to come from?
The system doesn't know what cash_in is beyond that you mentioned it and that
makes it impossible to multiply it with dollar which is a float type.
If cash_in is supposed to be an input from the user, you probably should make
it an int typ
thanks very much, great response really really appreciated it and now i
understand. i hate to ask again but can you see why it won't print the 'enter
and amount over 50' in the right place??
# -*- coding: cp1252 -*-def exchange(cash_in):euro=1dollar=1.35
base=50if cash_in>b
On Thu, Nov 17, 2011 at 4:32 PM, ADRIAN KELLY wrote:
>
> thanks very much, great response really really appreciated it and now i
> understand. i hate to ask again but can you see why it won't print the
> 'enter and amount over 50' in the right place??
>
Computers are unfailingly stupid machines.
i know i should use input but when i changed to raw_input it wouldn't recognise
the word print on the next line. honestly i have tried everything to get this
working..i am 6 hrs at one program
Adrian Kelly
1 Bramble Close
Baylough
Athlone
County Westmeath
0879495663
From: waynejw
i know i'm stupid but i have tried everything to get one line of text working,
i have written out pseudo and read every website.now i am getting this
error
Traceback (most recent call last): File "F:\VTOS ATHLONE\PYTHON_VTOS\foreign
exchange\f_ex4 - Copy.py", line 24, in ma
On 17/11/11 14:55, Prasad, Ramit wrote:
It means that no need to use the 'Struct' module for binary file read,
right?
Its not necessary but if the data does not already have a file handling
module then the struct module is a very convenient way of accessing the
data.
It really depends on
My mail client stripped new lines, at least on this machine, so I will
just top-post this. Sorry!
Your problem is that you say:
amount=0
def main()...
You then try to use amount in main, but main has no amount in it.
Either move "amount=0" inside main, or put a global reference:
amount=0
def main()
Rayon wrote:
I am trying to use winpexpect to connect a telnet session.
I keep getting this error.
raise ExceptionPexpect, 'Command not found: %s' % self.command
ExceptionPexpect: Command not found: telnet
Please copy and paste the entire traceback, not just the last couple of
lines.
On 17/11/11 23:12, ADRIAN KELLY wrote:
i know i should use input but when i changed to raw_input
In Python v3 use input()
In python v2 input() is dangerous, use raw_input() instead.
> ... it wouldn't recognise the word print on the next line.
Show us the exact code and error. You may be miss
On 17/11/11 21:29, ADRIAN KELLY wrote:
amount=float()
You don;t need this line because you assign a value to amount
immediately you run main()
def main():
amount = float(raw_input('how much do you want to change:'))
while amount<50:
print 'Sorry, cannot convert an amount under €50 '
To
def exchange(cash_in):
euro=1
dollar=1.35
base=50
if cash_in>base:
totalreturn=cash_in*dollar
else:
totalreturn=0
return totalreturn
amount=0
# this would be better placed inside the main function.
def main():
while amount<50:
amount = raw_input(
On 17/11/11 15:30, lina wrote:
tuple (which I don't understand).
You mean you don't understand the term 'tuple'?
Basically its just a collection of data.
You can get a
triple - 3 items,
a quadruple - 4 items,
quintiple - 5 items etc
The generic term for a collection of N items is a tuple.
tri
Hi all,
In my programme I am encoding what the user has in-putted.
What the user inputs will in a string, which might a mixture of letters and
numbers.
However I only want the letters to be encoded.
Does any-one how I can only allow the characters to be encoded ??
Big thanks,
Okay, so I am about to take up the banner of learning Python again. I had
started with 3.2 and I have a book that I like. But all of the things that
I want to use Python for appear to be 2.x specific. Will I be setting
myself up for failure if I continue learning 3 and then try to write
programs
On Nov 17, 2011 8:28 PM, "Mark Lybrand" wrote:
>
> Okay, so I am about to take up the banner of learning Python again. I had
started with 3.2 and I have a book that I like. But all of the things that
I want to use Python for appear to be 2.x specific. Will I be setting
myself up for failure if I
On 11/17/2011 8:45 PM, Nidian Job-Smith wrote:
Hi all,
In my programme I am encoding what the user has in-putted.
What the user inputs will in a string, which might a mixture of
letters and numbers.
However I only want the letters to be encoded.
Does any-one how I can only allow the chara
Hi all,
When i run a doctest on this piece of code (shown at bottom) i get this error
message [from the doctest]:
Trying:
rot13('5 The Parade')
Expecting:
'5 Gur Cnenqr'
**
File "F:\Uni\Rot13_1.py", line 12, in Rot13_
On 11/18/2011 10:29 AM, John wrote:
Hi all,
When i run a doctest on this piece of code (shown at bottom) i get
this error message [from the doctest]:
Trying:
rot13('5 The Parade')
Expecting:
'5 Gur Cnenqr'
**
File "
On 11/17/2011 04:29 PM, ADRIAN KELLY wrote:
#i am nearly there guys..please loop at the infinite loop i am getting
here..PLEASE!!#ADRIAN
def exchange(cash_in):euro=1dollar=float(1.35)base=50if
cash_in>base:totalreturn=cash_in*dollarelse:
> Date: Thu, 17 Nov 2011 22:49:33 -0500
> From: d...@davea.name
> To: nidia...@hotmail.com
> CC: tutor@python.org
> Subject: Re: [Tutor] Doctest error!
>
> On 11/18/2011 10:29 AM, John wrote:
> >
> > Hi all,
> > When i run a doctest on this piece of code
On 11/17/2011 10:56 PM, Nidian Job-Smith wrote:
Date: Thu, 17 Nov 2011 22:49:33 -0500
From: d...@davea.name
To: nidia...@hotmail.com
CC: tutor@python.org
Subject: Re: [Tutor] Doctest error!
On 11/18/2011 10:29 AM, John wrote:
Hi all,
When i run a doct
Forwarding on to the list... (hit reply to all next time)
On Thu, Nov 17, 2011 at 8:45 PM, Mark Lybrand wrote:
> so, use my 2.7 and not my 3.2 for my study? Or use my 3.2 for study and
> then do what I have to in 2.7 after including those lines?
>
> Thanks for the quick reply by the way. I am st
61 matches
Mail list logo