Python Wang novice, what is None taken when printing a function?

Asked 2 years ago, Updated 2 years ago, 19 views

def printAdd(n1, n2):
    print (n1+n2)

print(printAdd(3,4))

The result is 7 and None, but why does None come out here? Isn't the result of printAdd(3,4) 7?

python

2022-09-20 11:13

1 Answers

print(printAdd(3, 4))

 1. printAdd(3, 4)
 2. Print(3, 4) // 7 Output
 3. Return None // None returned because nothing was returned from the printAdd() function
 4. Print(None) // None Output


2022-09-20 11:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.