Ask Question
1 November, 21:05

Write a program that contains a main function and a custom, void function named show_larger that takes two random integers as parameters. This function should display which integer is larger and by how much. The difference must be expressed as a positive number if the random integers differ. If the random integers are the same, show_larger should handle that, too. See example outputs. In the main function, generate two random integers both in the range from 1 to 5 inclusive, and call show_larger with the integers as arguments.

+3
Answers (1)
  1. 2 November, 01:05
    0
    A program that contains a main function and a custom, void function named show_larger that takes two random integers as parameters.

    Explanation:

    The difference must be expressed as a positive number if the random integers differ. If the random integers are the same, show_larger should handle that, too. See example outputs.

    def main ():

    value_1=random. randrange (1,6)

    value_2=random. rangrange (1,6)

    def show_larger ():

    difference = value_1=-value_2

    if value_1 = = value_2:

    print ('The integers are equal, both are' + str (value_1))
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a program that contains a main function and a custom, void function named show_larger that takes two random integers as parameters. ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers