Hi,
I have a file having lines:-
48 ALA H = 8.33 N = 120.77 CA = 55.18 HA = 4.12 C = 181.50
104 ALA H = 7.70 N = CA = HA = 4.21 C =
85 ALA H = 8.60 N = CA = HA = 4.65 C =
Now i want to make two another file in which i want to put those lines for
which C is missing and another one for which
Thanks Wayne and Alan,
Here is what I finally ended up with:
def newCoord(x, y, oldWidth, oldHeight, newWidth, newHeight):
return( newWidth/2 + newWidth/oldWidth * x), (newHeight/2 -
newHeight/oldHeight * y)
for my earlier example, the old width and height would be 200, 200
respectively.
Th
On Thu, Jul 23, 2009 at 7:09 PM, wrote:
> Hello again,
> Here is my full attempt, can you please tell me if it is OK and if there
> should be any improvements
>
ws_industry = ('it', 'science')
code = ws_industry[0]
active = []
industries = [{'code': 'it', 'name': 'Informat
Hi, I'm Al, the author of Invent Your Own Computer Games with Python.
The book does indeed cover Pygame. The last four chapters covers the
Pygame library, and the final one has the source code for a complete
game.
I still recommend learning Python first though, it will make it much
easier to under
"chris Hynes" wrote
Its not a good idea to start a new thread by replying to an existing one.
Threaded newsreaders or mailing tools will still see it as part of the
old thread and bored readers may not notice the new subject...
However
have a data file in which the first line is made up of
Hello again,
Here is my full attempt, can you please tell me if it is OK and if there should
be any improvements
>>> ws_industry = ('it', 'science')
>>> code = ws_industry[0]
>>> active = []
>>> industries = [{'code': 'it', 'name': 'Information Technology'}, {'code':
>>> 'science', 'name': '
Think "linear relation".
For each of your new "horizontal" coordinates, there is a linear relation changing the "old" coordinate into the pixel coordinate of the pygame map.
You have to find the intercept and the slope of that linear relation.
There will be a second, unrelated "linear transform
thank you for all your answers
Original Message
From: Norman Khine
Apparently from: tutor-bounces+davidwilson=safe-mail@python.org
To: tutor@python.org
Subject: Re: [Tutor] dictionaries help
Date: Thu, 23 Jul 2009 21:59:01 +0100
> Also you can use list comprehension
>
> I
Also you can use list comprehension
In [1]: my_lst = [{'code': 'aaa', 'name': 'a name'}, {'code': 'bbb',
'name': 'b name'}]
In [2]: my_code = 'aaa'
In [3]: print [d for d in my_lst if d['code'] == my_code]
--> print([d for d in my_lst if d['code'] == my_code])
[{'code': 'aaa', 'name': 'a nam
> Date: Thu, 23 Jul 2009 14:05:36 +0800
> From: ld...@gmx.net
> To: Tutor@python.org
> Subject: [Tutor] mnemonics to better learn Python
>
> Dear List,
>
> in order to memorize which Python sequences are mutable or immutable, I
> focused on the SHAPE of the brackets that are associated with ea
I have a data file in which the first line is made up of words. Here is the
original data file:
#Column density-scaled with production rate 3.16227766016838e+25
-10. 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.00
I approach these things more along the lines of objects rather than looking
at the raw source code to remember what I'm doing.For example, I see (x, y,
z) and I think "ah, it's a little pre-packaged goodie of delicious
variables"
and when I see [x, y, z] I think "ah, it's a box with some candy at t
"Alan Gauld" wrote
Oops!
Should be:
def findDict(value, dictList):
for dct in dictList:
if dct.get('code', '') == my_code
if dct.get('code', '') == value
return dct
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
___
wrote
i would like to understand how dictionaries work.
They work like a lookup table.
You provide a key and lookup the corresponding value
in the dictionary. So to implement a traditional language
dictionary the keys would be words and the values would
be a list of definitions.
You read th
"Wayne" wrote
def draw_pixel(x, y):
w = screen.get_width()
h = screen.get_height()
screen.draw_pixel(w/2+x, h/2+y)
I think that should be h/2-y for the coordinates given?
Alan G.
___
Tutor maillist - Tutor@python.org
http://mail.pytho
this should work
def find_value(value, lst):
for obj in lst:
if value in obj.values():
return obj
>> find_value("aaa", my_lst)
Vince
On Thu, Jul 23, 2009 at 9:55 AM, wrote:
> hello,
> please excuse me, but i would like to understand how dictionaris work.
>
> for examp
hello,
please excuse me, but i would like to understand how dictionaris work.
for example:
>>> my_lst = [{'code': 'aaa', 'name': 'a name'}, {'code': 'bbb', 'name': 'b
>>> name'}]
>>> my_code = 'aaa'
from the above i would like to compare my_code and return the dictionary which
has code == my_c
Hi,
there also is:
"Invent Your Own Computer Games with Python", which apparently does not
use pygame (like Dawson).
http://pythonbook.coffeeghost.net/
I can't comment on the quality.
David
Mazhar Hussain wrote:
> Hello All! My name is Mazhar Hussain, and I am new to python, in
> fact, I am n
WoW! You all have given me lots to look at, think about, and play with.
Thank you one and all for your answers!
<><><>___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Thu, Jul 23, 2009 at 7:09 AM, Muhammad Ali wrote:
> Hi,
>
> I have some x and y co-ordinates ranging from (-100, 100) for each x and y.
> Something like this:
>
>100
> |
> |
> |
> |
> -100--
Hi,
I have some x and y co-ordinates ranging from (-100, 100) for each x and y.
Something like this:
100
|
|
|
|
-100--100
|
> Btw, I see that you're the author of a Python book. I am using Python for my
> work as a researcher. Should, in your opinion, the learning strategy for
> somebody like me vis-a-vis somebody who is becoming a professional programmer
> be
> very much different?
Not in the early days. The ar
On Wed, Jul 22, 2009 at 10:48:49PM -0500, Chris Castillo wrote:
> *I'm supposed to be reading in names a grades from a text file like so:
> *
> Chris
> 100
> 89
> 76
> 0
My Spidey Senses are picking up "homework assignment", so I'll try to
nudge you in a general direction without doing your work
just FYI, A simple, not versatile way,
kargs = dict([i.split('=', 1) for i in sys.argv[1:]])
Changsheng Jiang
On Thu, Jul 23, 2009 at 14:11, Todd Matsumoto wrote:
> Hello Tutors,
>
> I'm building a script that now needs a command line inte
24 matches
Mail list logo