On 24/10/12 04:33, Mark Lawrence wrote:
On 24/10/2012 04:01, Matthew D wrote:
big top post snipped.
Any chance of your prof teaching you *NOT* to top post and to use plain
English while you're at it?
I didn't think the top posting was a problem here. The bigger issue was
that he kept the mai
Hi,
I am facing issue with input() of Python 2.7. When i run the program it
doesn't display any line to take user input . Below is the code:
def user_input()
fat_grams = input("How many grams of fat are in one serving? ")
total_calories = input("How many total calories are in one serving? ")
On 10/24/2012 07:15 AM, Morten Engvoldsen wrote:
> Hi,
Hi. Welcome to the list.
> I am facing issue with input() of Python 2.7. When i run the program it
> doesn't display any line to take user input . Below is the code:
>
> def user_input()
Need a trailing colon here.
>fat_grams = input("Ho
On 24/10/2012 12:15, Morten Engvoldsen wrote:
[duplicate question snipped]
Thanks for asking the same question here that you asked on c.l.py 38
minutes previously.
--
Cheers.
Mark Lawrence.
___
Tutor maillist - Tutor@python.org
To unsubscribe or
On Wed, Oct 24, 2012 at 7:15 AM, Morten Engvoldsen wrote:
>
> I am facing issue with input() of Python 2.7
>
>
>fat_grams = input("How many grams of fat are in one serving? ")
>total_calories = input("How many total calories are in one serving? ")
>print("A food product having {0}
On Wed, Oct 24, 2012 at 10:18 AM, Morten Engvoldsen
wrote:
>
> grams = eval(raw_input("How many grams? "))
>
> Is it good practice to write code in this way.
That's equivalent to using input().
http://docs.python.org/library/functions.html#input
It's not generally a good practice. Sometimes it
Hi,
a = [['jimmy', '25', 'pancakes'], ['tom', '23', 'brownies'], ['harry',
'21', 'cookies']]
for i in a:
if (i[1] == '25' or i[1] == '26'):
print 'yes'
else:
print 'Not found'
This prints:
yes
not found
I want it to print "yes" for each positive match but nothing for a negative
m
On 24/10/12 13:22, Mark Lawrence wrote:
On 24/10/2012 12:15, Morten Engvoldsen wrote:
[duplicate question snipped]
Thanks for asking the same question here that you asked on c.l.py 38
minutes previously.
It's a reasonable question for the tutor list and it seems reasonable
that somebody on
Let me modify this example:
a = [['jimmy', '25', 'pancakes'], ['tom', '23', 'brownies'], ['harry',
'21', 'cookies']]
for i in a:
*b = i[0]*
if (i[1] == '25' or i[1] == '26'):
print *b*
else:
print 'Not found'
This will output:
*jimmy*
*Not found*
*Not found*
*
*
How do
On 24/10/12 17:27, Saad Javed wrote:
a = [['jimmy', '25', 'pancakes'], ['tom', '23', 'brownies'], ['harry',
'21', 'cookies']]
for i in a:
if (i[1] == '25' or i[1] == '26'):
print 'yes'
else:
print 'Not found'
I want it to print "yes" for each positive match but nothing
Thanks!
If not matched: < does it mean that "if the value of matched is not
true, print Not found"?
print "Not found"
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/t
On 24/10/12 17:59, Saad Javed wrote:
Thanks!
If not matched: < does it mean that "if the value of matched is not
true, print Not found"?
Yes exactly. matched starts off as False and will remain that way until
a match is found at which point we set it to True.
--
Alan G
Author of the Le
On Oct 24, 2012, at 12:27 PM, tutor-requ...@python.org wrote:
> Hi,
>
> a = [['jimmy', '25', 'pancakes'], ['tom', '23', 'brownies'], ['harry',
> '21', 'cookies']]
> for i in a:
>if (i[1] == '25' or i[1] == '26'):
>print 'yes'
> else:
>print 'Not found'
Suggestion: use names whi
On Wed, Oct 24, 2012 at 12:49 PM, Alan Gauld wrote:
> On 24/10/12 17:27, Saad Javed wrote:
>
>> a = [['jimmy', '25', 'pancakes'], ['tom', '23', 'brownies'], ['harry',
>> '21', 'cookies']]
>
>
>> for i in a:
I would change this (which works but I think is simpler
>> if (i[1] == '25' or i[1]
On Wed, Oct 24, 2012 at 1:30 PM, Joel Goldstick
wrote:
>
>>> if (i[1] == '25' or i[1] == '26'):
>
> like this
> if i[1] in ('25', '26'):
Using "in ['25', '26']" also checks a compiled tuple constant:
>>> compile("x in ['25', '26']", '', 'eval').co_consts
('25', '26', ('25',
On 24/10/12 18:49, eryksun wrote:
Using "in ['25', '26']" also checks a compiled tuple constant:
>>> compile("x in ['25', '26']", '', 'eval').co_consts
('25', '26', ('25', '26'))
3.x adds frozenset support:
>>> compile("x in {'25', '26'}", '', 'eval').co_consts
('25', '26'
On Wed, Oct 24, 2012 at 3:24 PM, Alan Gauld wrote:
> On 24/10/12 18:49, eryksun wrote:
>
>> Using "in ['25', '26']" also checks a compiled tuple constant:
>>
>> >>> compile("x in ['25', '26']", '', 'eval').co_consts
>> ('25', '26', ('25', '26'))
>>
>> 3.x adds frozenset support:
>>
>>
I'm in the process of learning python and migrating away from bash
scripting. I'm in the process of converting my bash scripts that
essentially ssh to another host via shared keys, execute commands
remotely, and exit. To do this I started using paramiko but eventually
decided to do it w/ subpro
Hello all,
I am looking for simple python code that will take a given string and
distort it, captcha like. it is for artistic purposes, so no verification
required. I just need the image q text distortion code.
Thanks!!!
tsila
--
--
missdata.org
On 24/10/2012 21:11, Mike wrote:
I'm in the process of learning python and migrating away from bash
scripting. I'm in the process of converting my bash scripts that
essentially ssh to another host via shared keys, execute commands
remotely, and exit. To do this I started using paramiko but eventu
On 24/10/2012 22:05, Tsila Hassine wrote:
Hello all,
I am looking for simple python code that will take a given string and
distort it, captcha like. it is for artistic purposes, so no verification
required. I just need the image q text distortion code.
Thanks!!!
tsila
I'll send you some code i
On Wed, Oct 24, 2012 at 4:11 PM, Mike wrote:
>
> tar: /home/rev/code/beavis/test/24.10.2012: Cannot stat: No such file or
> directory
> tar: 15\:06\:52.tgz: Cannot stat: No such file or directory
You have a space in the filename:
lt = time.localtime(time.time())
return "%02d.%02d.%04d %0
On 10/24/12, Tsila Hassine wrote:
> Hello all,
> I am looking for simple python code that will take a given string and
> distort it, captcha like. it is for artistic purposes, so no verification
> required. I just need the image q text distortion code.
> Thanks!!!
> tsila
You might look into writ
On 25/10/12 08:05, Tsila Hassine wrote:
Hello all,
I am looking for simple python code that will take a given string and
distort it, captcha like.
You won't find any such simple code, because distorting images is not
simple.
This is a mailing list for learning how to program in the Python
prog
On 25/10/12 03:49, Alan Gauld wrote:
I confess I'm not keen on the else part of a for loop and never
use it, I think it leads to more confusion than anything. It
doesn't do what most folks seem to expect, it should probably be
called 'end' or something similar rather than 'else' IMHO.
I am kee
>>> Using "in ['25', '26']" also checks a compiled tuple constant:
>>>
>...
>>> 3.x adds frozenset support:
>>>
>>> >>> compile("x in {'25', '26'}", '', 'eval').co_consts
>>> ('25', '26', frozenset({'25', '26'}))
>>
>>
>> I confess I don't know what that means!
>
>Sorry, I was showing th
Alan Gauld schreef op wo 24-10-2012 om 17:49 [+0100]:
> I confess I'm not keen on the else part of a for loop and never use
> it,
> I think it leads to more confusion than anything. It doesn't do what
> most folks seem to expect, it should probably be called 'end' or
> something similar rather t
27 matches
Mail list logo