The task was to make python code which utilizes functions and main program.(adsbygoogle = window.adsbygoogle || []).push({});

the objective is to make function which takes two parameters (ostensibly number values) and outputs the smaller of the numbers.

I realized that the problem statement in a sense was incomplete because there is the possibility that with real numbers, the parameter numbers are equal size, and therefore equal. Therefore it is impossible that in such a case there exists a smaller number.

Question.

I think that I understood intuitively that if the one number is NOT smaller than the other number. And the one number is NOT bigger than the other number... I think probably the numbers are equal.

What is the mathematical or logical principle in which this reasoning is grounded (is it something like law of excluded middle). This thinking seems to work for real numbers on the number line, at least)

It also seems to work for integers, when both are integer. And indeed the set of reals, seems to include subset of integers.

However in python I thiink it is not allowed to put fraction into float type of input?

Code (Python):def small(number1,number2):

if number1>number2:

return number2

elif number1<number2:

return number1

else:

same="the values which you gave are equal"

return same

a=float(input("tell first number"))

b=float(input("tell second number"))

result= small(a,b)

print(result)

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Python Question about program options in if-clause

Have something to add?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**