Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with function
#3
Well, your function prints the sum of the two arguments but after that, the function returns None which print() is printing. A function returns None if you don't specify something else.
You can just call the function or to return the sum

Returning the sum
x=int(input('the first number'))
y=int(input('the second number'))

def suma(a,b):
 
   return a+b

print(suma(x, y))
Just call the function.

x=int(input('the first number'))
y=int(input('the second number'))

def suma(a,b):
 
   print(a+b)

suma(x , y)
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
help with function - by meggy - Apr-17-2017, 07:33 AM
RE: help with function - by Mekire - Apr-17-2017, 09:06 AM
RE: help with function - by wavic - Apr-17-2017, 09:15 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020