ManGeo's blog

By ManGeo, history, 5 years ago, In English

This is a classic case which we encounter in the world of programming.

Different languages provide various methods to undertake this operation.

Well in my case, I believe that Python provides a very easy method to undertake this:

CASE-1:

A primitive way arises when the number of inputs are known like 3 innputs,

Then we may use,

Code:

a, b, c = map(int,input().split())

CASE-2:

What about the case, when number of inputs is unknown?

You might be familiar with the 'sort()' built- in function. Well that comes handy here.

Code:

a = list(map(int,input().split()))

a.sort()

Here 'sort()' gives our task a nice outlook too.

Well, hope you might have learnt something new today. I know many of you might already be familiar with it but it is always helpful if you have a glance at things at which you might be perfect too.

  • Vote: I like it
  • -10
  • Vote: I do not like it