+ 2

You are provided with two numbers. Find and print the smaller number.

You are provided with two numbers as input

2nd Jul 2022, 9:12 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
28 Answers
+ 10
a = int(input()) b = int(input()) if a < b: print(a) elif a > b: print(b)
2nd Jul 2022, 6:36 PM
Geerbani Pal Shashi
Geerbani Pal Shashi - avatar
+ 9
a = int(input()) b = int(input()) print(min(a,b))
4th Jul 2022, 12:18 AM
Niels F 🇩🇪 <html challenger>
Niels F 🇩🇪 <html challenger> - avatar
+ 5
* get 2 input() * convert input to numeric data type * use an if-statement and >= to compare the numbers If you need help, please explain what your issue us.
2nd Jul 2022, 9:15 AM
Lisa
Lisa - avatar
+ 3
Please be exact about the expected input. If you get the input as 1 line, split the line at the separator. Then convert each element to a numeric data type. Then compare the numbers.
2nd Jul 2022, 9:21 AM
Lisa
Lisa - avatar
+ 2
input().split(",") You get a list of strings: make each element an integer, then you can use min(). And PLEASE: ⭐⭐⭐Try to put your comments or additions in 1 comment instead of spreading each bit of information into an extra comment.⭐⭐⭐
2nd Jul 2022, 9:30 AM
Lisa
Lisa - avatar
+ 1
lis =[ ] count = int(input()) for n in range(count): number = int(input()) lis.append(number) print(min(lis))
2nd Jul 2022, 9:13 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
+ 1
Find smallest in the two numbers 25'2
2nd Jul 2022, 9:17 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
+ 1
25,2
2nd Jul 2022, 9:18 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
+ 1
You need only 2 inputs. Your code would require min 3 inputs to get the 2 numbers. If you are referring to a sololearn task, mention course name and task number.
2nd Jul 2022, 9:18 AM
Lisa
Lisa - avatar
+ 1
We should write program without using hardcode
2nd Jul 2022, 9:18 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
+ 1
That means input( )
2nd Jul 2022, 9:19 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
+ 1
Int(input( )). split ("")...?
2nd Jul 2022, 9:26 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
+ 1
l=[int(input() for _ in range(2)] print(l[l[1]<l[0]])
3rd Jul 2022, 4:34 AM
Oma Falk
Oma Falk - avatar
+ 1
a, b = int(input()) if a > b: print (a) else: print(b)
3rd Jul 2022, 11:25 PM
Маврычев Андрей
Маврычев Андрей - avatar
+ 1
print(min(int(input()), int(input())))
4th Jul 2022, 1:16 AM
Niels F 🇩🇪 <html challenger>
Niels F 🇩🇪 <html challenger> - avatar
0
Question
2nd Jul 2022, 9:17 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
0
a = int(input()) small = min(a) print (a)
2nd Jul 2022, 9:20 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
0
If I give input value 25,5
2nd Jul 2022, 9:21 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
0
I am getting error:- Invalid literal for int( ) with base 10
2nd Jul 2022, 9:22 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
0
Because you need to split the input string at ",", THEN convert each element to int()
2nd Jul 2022, 9:23 AM
Lisa
Lisa - avatar