0

How can build a function which gives sth? Please give an example

6th Feb 2020, 7:16 AM
Amir
7 Answers
+ 1
1. indention indent once more all lines in your function 2. print(func(a, b))
6th Feb 2020, 7:54 AM
Oma Falk
Oma Falk - avatar
+ 3
boy.... seeing a code working is endorphin at its best. Dont miss that experience and hack the code into code playground!!! Cant be wrong too much... right?
6th Feb 2020, 8:18 AM
Oma Falk
Oma Falk - avatar
+ 1
def givesth(): return "giveSomething"
6th Feb 2020, 7:24 AM
Oma Falk
Oma Falk - avatar
+ 1
Amir ...now its up to you that homework is not too hard.
6th Feb 2020, 7:43 AM
Oma Falk
Oma Falk - avatar
0
I mean a function that give two integers and check their values then add or multiply them
6th Feb 2020, 7:36 AM
Amir
0
def func(x,y): if (x*y)<=1000 : return x*y else: return x+y a = input("a num") b = input ("a num") func(a,b) #what's its problem?
6th Feb 2020, 7:51 AM
Amir
0
def func(x,y): if (x*y)<=1000 : return x*y else: return x+y a = input("a num") b = input ("a num") print(func(a,b)) Is it correct now?
6th Feb 2020, 8:08 AM
Amir