Hello David, and welcome!
On Sat, Jan 05, 2019 at 11:18:04AM -0500, David Lynch wrote:
[...]
> From what I've read about functions I should be able to define a function
> with 2 variables? And then I can add all of my code into that function by
> indenting it.
So far so good! Here's an example
On 05/01/2019 16:18, David Lynch wrote:
> Hello,
> I'm not sure if this is where I can find this sort of help but I am
> struggling understanding functions. I have written a simple math code but I
> feel like it could be improved if I were to use it in a function.
You arein the right place and you
Hello,
I'm not sure if this is where I can find this sort of help but I am
struggling understanding functions. I have written a simple math code but I
feel like it could be improved if I were to use it in a function.
>From what I've read about functions I should be able to define a function
with 2
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 returns it
On Sat, Mar 25, 2017 at 3:31 PM, 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 there are two print() functions, one inside the function and
another outside. When a function does not
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 returns its default value - None.
So the print() inside
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(