Question

Create a function named first_is_smaller(...) which receives two integer parameters (n1 and n2) and returns a...

Create a function named first_is_smaller(...) which receives two integer parameters (n1 and n2) and returns a Boolean value True if the value in the first parameter is smaller than the second and False otherwise.

As an example, the following code fragment:

print(first_is_smaller(10,20))

should produce the output:

True

Language: Python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

"""

    python program which define first_is_smaller() function

    if first number is less then return true else false

"""

# first_is_smaller() function defination which takes two integer and return boolean

def first_is_smaller(n1, n2):

    # It checks whether n1 is smaller than n2 and return true

    if n1 < n2:

        return True

    else:

        return False        # else return false

# defination of main function

def main():

    n1 = 0                              # represent two integer

    n2 = 0

    n1 = int(input("\nEnter First number: "))  # Get new int input

    n2 = int(input("Enter Second number: "))  # Get new int input

    print(first_is_smaller(n1, n2))       # call first_is_smaller() function and print return value

# it calls main function  

if __name__== "__main__":

    main()

Add a comment
Know the answer?
Add Answer to:
Create a function named first_is_smaller(...) which receives two integer parameters (n1 and n2) and returns a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT