+ 1

functon

def minimum(x,y): x=int(input("enter the first number")) print(x) y=int(input("enter the second number")) print(y) if x>y: return y else: return x minimum( , )#i don't know what should i put here #this code ask for two numbers then will show the minimum but as you see doesnt work correctly.can you help me.

10th Oct 2020, 10:31 AM
Nooshin
3 ответов
+ 3
If you are going to collect the inputs in the function, you don't need parameters in function header. you can do it like this: def minimum(): x=int(input("enter the first number")) print(x) y=int(input("enter the second number")) print(y) if x>y: return y else: return x print(minimum())
10th Oct 2020, 10:39 AM
Lothar
Lothar - avatar
+ 3
You have a general problem with parameters and input through some of your codes as far as I could see. Functions are 1. defined 2. Called Up to now u did the Definition. Here please only work with parameters x and y...not with input Now for call: a=int(input()) b=int(input()) #here comes the call print(minimum(a,b))
10th Oct 2020, 10:41 AM
Oma Falk
Oma Falk - avatar
+ 1
def minimum(x,y): if x>y: return y else: return x x=int(input("enter the first number")) print(x) y=int(input("enter the second number")) print(y) print(minimum(x,y))
10th Oct 2020, 10:42 AM
Abhay
Abhay - avatar