On 25-03-17 11:17, Alan Gauld via Tutor wrote:
method:
print(' '.join(anotherFunction(4))
Many thanks!
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Many thanks!
On 25-03-17 11:17, Alan Gauld via Tutor wrote:
On 25/03/17 10:01, Peter O'Doherty wrote:
def myFunc(num):
for i in range(num):
print(i)
print(myFunc(4))
0
1
2
3
None #why None here?
Because your function does not have an explicit return
value so Python re
Hi,
Apologies for the very basic question but could anyone explain the
behaviour of these two functions (in Python3.5)?
def myFunc(num):
for i in range(num):
print(i)
print(myFunc(4))
0
1
2
3
None #why None here?
def myFunc(num):
for i in range(num):
return i
print(
To the people who kindly replied to my question: many thanks!
On 10/31/2013 06:29 PM, Danny Yoo wrote:
As an aside: It shouldn't be too bad to write a "generator" for the
geometric series, so that we can pick out the terms on-demand.
#
>>> def geometric(base):
Hi List,
I know a geometric sequence can be produced by:
series = [2**x for x in range(7)]
But I would like to curtail the sequence before the last element excedes
a certain value. Is there a better way of doing it that the following:
for x in range(20):
series_element = 2**x
print s
Many, many thanks to all those who replied to my question. I hope the
next time I post, it will be with something more advanced.
Judging by the volume of replies, is it fair to say that this problem
was much too advanced for page 16 of an introductory text?
Best wishes,
Peter
__
On 11/22/2012 03:17 PM, Walter Prins wrote:
Hi Peter,
On 22 November 2012 12:55, Peter O'Doherty <mailto:m...@peterodoherty.net>> wrote:
Hi list,
Firstly, apologies for the low-level nature of this question -
it's really quite basic but I don't seem to be
is largest among all odd numbers.
Instead you are printing the number which is largest AND odd.
--
Varun
On Thu, Nov 22, 2012 at 6:25 PM, Peter O'Doherty
mailto:m...@peterodoherty.net>> wrote:
Hi list,
Firstly, apologies for the low-level nature of this question -
it
Hi list,
Firstly, apologies for the low-level nature of this question - it's
really quite basic but I don't seem to be able to solve it.
I need to write a program that examines 3 variables x, y, z, and prints
the largest odd number. I've tried all sorts of variations and this is
the current v