On 05/23/2017 11:38 AM, Rafael Knuth wrote:
> I wrote a function (shopping list) which calculates the total price of
> the purchase (quantity * price) as well as the stock change (stock -
> quantity). I know the latter is imperfect (my function does not take
> into account if items are out of stock
On 23/05/17 18:38, Rafael Knuth wrote:
> Now, I want to print the item next to the stock update, and I am
> receiving an error message. I couldn't figure out how to fix that:
So show us the error message, all of it.
I can't begin to guess what it might be.
UI also don't understand what "print th
I wrote a function (shopping list) which calculates the total price of
the purchase (quantity * price) as well as the stock change (stock -
quantity). I know the latter is imperfect (my function does not take
into account if items are out of stock for example, but that's my next
challenge. The func
On Thu, Mar 2, 2017 at 8:42 AM, Rafael Knuth wrote:
> I wrote a program that is supposed to take orders from customers in a bar.
> If the desired drink is available, the customer will be served. If
> not, he will be informed that the drink is not available. This is what
> I wrote:
>
> bar = ["bee
On 03/02/2017 08:06 AM, Alan Gauld via Tutor wrote:
> On 02/03/17 13:42, Rafael Knuth wrote:
>
>> bar = ["beer", "coke", "wine"]
>>
>> customer_order = input("What would you like to drink, dear guest? ")
>>
>> for drink in bar:
>> if customer_order != drink:
>> print ("Sorry, we don't
On 02/03/17 13:42, Rafael Knuth wrote:
> bar = ["beer", "coke", "wine"]
>
> customer_order = input("What would you like to drink, dear guest? ")
>
> for drink in bar:
> if customer_order != drink:
> print ("Sorry, we don't serve %s." % customer_order)
> else:
> print ("Su
I wrote a program that is supposed to take orders from customers in a bar.
If the desired drink is available, the customer will be served. If
not, he will be informed that the drink is not available. This is what
I wrote:
bar = ["beer", "coke", "wine"]
customer_order = input("What would you like
On 07/01/16 18:31, richard kappler wrote:
> Alan, have you ever actually been guilty of 'missing something'? :-)
Actually quite often.
Usually when its late at night(tired) or early morning(no coffee)
or I'm rushing to go someplace.
But it happens quite a lot, Usually Steven or Peter or someone
w
Hi there Richard,
>I have a stream of incoming xml data. I can receive the data, parse
>the data, etc, so long as I don't get fancy and I have a miniscule
>delay in between each message. If I get rid of the time delay,
>which I need to, I need the script to continuously process the
>incoming
On 27/06/2012 08:47, Alan Gauld wrote:
On 27/06/12 00:32, Elaina Ann Hyde wrote:
Thanks for the comment, the set type is no problem for me, this is
just a variable that I call set... and it works great for my purposes,
It may work just now but if you ever decide you need to use a Python set
y
On Wed, Jun 27, 2012 at 08:47:08AM +0100, Alan Gauld wrote:
> On 27/06/12 00:32, Elaina Ann Hyde wrote:
>
> > Thanks for the comment, the set type is no problem for me, this is
> >just a variable that I call set... and it works great for my purposes,
>
> It may work just now but if you ever d
On 27/06/12 00:32, Elaina Ann Hyde wrote:
Thanks for the comment, the set type is no problem for me, this is
just a variable that I call set... and it works great for my purposes,
It may work just now but if you ever decide you need to use a Python set
you will be unable to because you h
Yay Python:
The solution was a syntax one, if anyone else ever feels like massively
multi-plotting histograms, here is the working code:
#--
fig, axes = plt.subplots(nrows=5, ncols=6, figsize=(12,6))
index=0
for b in axes:
for ax in b:
inde
, 2012 at 9:19 PM, Don Jennings wrote:
> > Message: 1
> > Date: Tue, 26 Jun 2012 18:40:50 +1000
> > From: Elaina Ann Hyde
> > To: tutor@python.org
> > Subject: [Tutor] Looping over histogram plots
>
>
>
> >set=(dat['a'+str(index)] == 1
> Message: 1
> Date: Tue, 26 Jun 2012 18:40:50 +1000
> From: Elaina Ann Hyde
> To: tutor@python.org
> Subject: [Tutor] Looping over histogram plots
>set=(dat['a'+str(index)] == 1.00)
You should not override the builtin set() type [1] as you've done her
Hello all,
I have been making some big multiplots lately and found a nice little
way of writing out 30 plots as follows, this part works great and leads up
to my question, here I have 30 sets defined by the set=(), in this case I
get a nice arrangement of 30 plots for V(GSR) and Log(g) (2 variab
Please always put a meaningful subject line in when you post.
wrote in message
I know, I'm a total noob (started yester day)
But when I enter this code:
x = 1
if x>0:
??? a = raw_input ("Type something in...I will echo it:")
??? print a
??? x=x+1
it does not loop..am I missing something here
>
> xrange was a kludge to improve on range's memory efficiency
> but it is a horrible name that obscures the code.
>
> Also it does not exist in v3 so if you use it you will need to change
> the code for v3. It is as well to be as consistent with v3 as possible
> IMHO
>
> Alan G
I have felt th
"Matt" wrote
As an aside, why use range rather than xrange? I was under the impression
that xrange is a generator and therefore more memory efficient.
xrange was a kludge to improve on range's memory efficiency
but it is a horrible name that obscures the code.
Also it does not exist in v3 s
On Mon, Apr 20, 2009 at 12:34 PM, Matt
> wrote:
> Thank you. Func is in fact a call to an external non-python program. =]
> Therefore, the loop must actually be mindlessly done. My question, however,
> has been answered.
> As an aside, why use range rather than xrange? I was under the impression
Thank you. Func is in fact a call to an external non-python program. =]
Therefore, the loop must actually be mindlessly done. My question, however,
has been answered.
As an aside, why use range rather than xrange? I was under the impression
that xrange is a generator and therefore more memory effic
"Matt" wrote
Let's say I want to run func 10 times Is there a more pythonic way to do
it
than this:
for i in xrange(10):
func()
Yes, use range() rather than xrange :-)
But more seriously, as others have pointed out, if func() is well
written then calling it ten times will have no e
Le Mon, 20 Apr 2009 17:26:30 +0200,
"A.T.Hofkamp" s'exprima ainsi:
> Matt wrote:
> > Hey everyone,
> >
> > First post to this list. I hope I'm doing it right.
> >
> > Let's say I want to run func 10 times Is there a more pythonic way to do
> > it than this: for i in xrange(10):
> > func()
>
>
Matt wrote:
Hey everyone,
First post to this list. I hope I'm doing it right.
Let's say I want to run func 10 times Is there a more pythonic way to do it
than this:
for i in xrange(10):
func()
no, that looks fine for your requirement.
What may be a bit weird here is the requirement to run
On Mon, Apr 20, 2009 at 8:48 AM, Matt
> wrote:
> Hey everyone,
>
> First post to this list. I hope I'm doing it right.
>
> Let's say I want to run func 10 times Is there a more pythonic way to do it
> than this:
> for i in xrange(10):
> func()
AFAIK that's the most pythonic way to do it... and
Hey everyone,
First post to this list. I hope I'm doing it right.
Let's say I want to run func 10 times Is there a more pythonic way to do it
than this:
for i in xrange(10):
func()
Thanks.
___
Tutor maillist - Tutor@python.org
http://mail.python.org
Am Fri, 19 Dec 2008 15:57:49 +
schrieb Tim Golden :
> Eduardo Vieira wrote:
> > Hello, this is my first post in this list and I'm not a programmer,
> > but am enjoying learning python.
> > I'm trying to make a script to add worksheets to excel files:
> > I managed to implement this code:
> >
Tim Golden wrote:
Eduardo Vieira wrote:
Hello, this is my first post in this list and I'm not a programmer,
but am enjoying learning python.
I'm trying to make a script to add worksheets to excel files:
I managed to implement this code:
import os
folder = 'C:\\Personal\\oldxlsformat\\'
from win
Thank you, now it worked! I made these changes to my code:
for ficheiro in os.listdir(folder):
file = os.path.join(folder, ficheiro) #added this
if ficheiro.endswith('.xls'):
wb = xl.Workbooks.Open(file, 2) # changed this
On Fri, Dec 19, 2008 at 8:57 AM, Tim Golden wrote:
> Eduard
Eduardo Vieira wrote:
Hello, this is my first post in this list and I'm not a programmer,
but am enjoying learning python.
I'm trying to make a script to add worksheets to excel files:
I managed to implement this code:
import os
folder = 'C:\\Personal\\oldxlsformat\\'
from win32com.client import
Hello, this is my first post in this list and I'm not a programmer,
but am enjoying learning python.
I'm trying to make a script to add worksheets to excel files:
I managed to implement this code:
import os
folder = 'C:\\Personal\\oldxlsformat\\'
from win32com.client import Dispatch
xl = Dispatch(
James wrote:
> Hi. :)
>
> I'm trying to write a loop to simplify my life (and code :)). The
> loop is going to iterate over a list of values that I have to change
> in a file. I think my problem is better described with some code. :)
Use a dictionary instead of a tuple ...
# variables
editVal
Hi. :)
I'm trying to write a loop to simplify my life (and code :)). The
loop is going to iterate over a list of values that I have to change
in a file. I think my problem is better described with some code. :)
# variables
interface = "eth0"
address = "192.168.1.5"
mask = "255.255.255.0"
John Fouhy wrote:
> On 24/09/06, Python <[EMAIL PROTECTED]> wrote:
>> slices may be the best way to go
>> listA = biglist[0::3] # start from index 0 taking every third element
>> listB = biglist[2::3] # start from index 2 taking every third element
>
> I'm not certain they would be.. If you do
On 24/09/06, Python <[EMAIL PROTECTED]> wrote:
> slices may be the best way to go
> listA = biglist[0::3] # start from index 0 taking every third element
> listB = biglist[2::3] # start from index 2 taking every third element
I'm not certain they would be.. If you do that, you will:
1. Create
kumar s wrote:
> hi,
>
> thank you. this is not a homework question.
>
> I have a very huge file of fasta sequence.
>
> I want to create a dictionary where 'GeneName' as key
> and sequence of ATGC characters as value
>
>
> biglist = dat.split('\t')
> ['GeneName ','','ATTAAGG
#!/usr/bin/python
# or whatever is the absolute path to python on your system
counter = 0
for i in "a","b","c","d","e","f","g" :
if counter%3 == 0 :
print i + " list one ", counter, counter%3
if counter%3 == 1 :
print i + " list two ", counter, cou
On Sat, 2006-09-23 at 09:03 -0700, kumar s wrote:
> hi,
>
> thank you. this is not a homework question.
>
> I have a very huge file of fasta sequence.
>
> > GeneName \t
> AATTAAGGAA..
>
>
>
>
>
> (1000 lines)
> AATAAGGA
> >GeneName \t
> GGAG
kumar s wrote:
> [snip]
> so I want to select 0,3,6,9 elements into listA
> and 2,5,8,11 and so on elements into listB
>
>
Here's a hint:
for j in range(0, len(biglist), 3): # this will set j = 0, 3, 6, etc.
--
Bob Gailer
510-978-4454
___
Tutor mai
hi,
thank you. this is not a homework question.
I have a very huge file of fasta sequence.
> GeneName \t
AATTAAGGAA..
(1000 lines)
AATAAGGA
>GeneName \t
GGAGAGAGATTAAGAA
(15000 lines)
when I read this as:
f2= open('myfile','r')
dat = f2.
keep a counter in your loop. is this a homework question?
On Sep 23, 2006, at 8:34 AM, kumar s wrote:
> hi,
>
> the reason could be that I did not quite understand
> the concept of looping
>
> I have a list of 48 elements
>
> I want to create another two lists , listA and listB
>
> I want to loo
hi,
the reason could be that I did not quite understand
the concept of looping
I have a list of 48 elements
I want to create another two lists , listA and listB
I want to loop through the list with 48 elements and
select element with index 0,3,6,9,12 ..etc into listA
select elements with
On Mon, 24 Apr 2006, Etrade Griffiths wrote:
> just feeling my way into Python with a small app that reads data from
> file, creates objects using that data, stores the objects in a list,
> loops over the list doing comparison tests to filter out various
> objects. Here is a code snippet:
>
Ed
the problem is that my original code did not have the closing brackets for
the method calls get_a and get_b whereas the code snippet I posted
did. That's probably why your version works and mine failed. Thanks for
your help!
Alun
At 17:19 24/04/2006, Ed Singleton wrote:
>On 24/04/06, Etr
On 24/04/06, Etrade Griffiths <[EMAIL PROTECTED]> wrote:
> Hi
>
> just feeling my way into Python with a small app that reads data from
> file, creates objects using that data, stores the objects in a list, loops
> over the list doing comparison tests to filter out various objects. Here is
> a
Hi
just feeling my way into Python with a small app that reads data
from file, creates objects using that data, stores the objects in a list,
loops over the list doing comparison tests to filter out various
objects. Here is a code snippet:
class myObj:
def __init__(self,a,b):
self.a
46 matches
Mail list logo