You are provided with two numbers. Find and print the smaller number. | Sololearn: Learn to code for FREE!

+2

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

You are provided with two numbers as input

7/2/2022 9:12:16 AM

chandrakanth karamthod

28 Answers

New Answer

+10

a = int(input()) b = int(input()) if a < b: print(a) elif a > b: print(b)

+9

a = int(input()) b = int(input()) print(min(a,b))

+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.

+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.

+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.⭐⭐⭐

+1

lis =[ ] count = int(input()) for n in range(count): number = int(input()) lis.append(number) print(min(lis))

+1

Find smallest in the two numbers 25'2

+1

+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.

+1

We should write program without using hardcode

+1

That means input( )

+1

Int(input( )). split ("")...?

+1

l=[int(input() for _ in range(2)] print(l[l[1]<l[0]])

+1

a, b = int(input()) if a > b: print (a) else: print(b)

+1

print(min(int(input()), int(input())))

0

0

a = int(input()) small = min(a) print (a)

0

If I give input value 25,5

0

I am getting error:- Invalid literal for int( ) with base 10

0

Because you need to split the input string at ",", THEN convert each element to int()