1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
cestrela7 [59]
3 years ago
15

Write a python program that contains a main function and a custom, void function named show_larger that takes two random integer

s 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.
Computers and Technology
1 answer:
sladkih [1.3K]3 years ago
4 0
Def show_larger(n1,n2):
if n1>n2:
print(str(n1)+" is larger than "+str(n2)+" by "+str(n1-n2))
elif n2>n1:
print(str(n2)+" is larger than "+str(n1)+" by "+str(n2-n1))
else:
print(str(n2)+" is same as "+str(n1))
import random
def main():
n1 = random.randint(1, 5)
n2 = random.randint(1, 5)
show_larger(n1,n2)

main()
You might be interested in
Tipos de lenguajes relacionados con c++?
Ber [7]

Answer:

Programación Java, Programación Python, Ruby

Explanation: Porque ellas son ...

3 0
3 years ago
A _______ acts as a security buffer between a corporation's private network and all external networks.
Contact [7]
The answer is a firewall. It is a system that will block potentially harmful software or websites from accessing your computer.
3 0
3 years ago
Which of the following creates a photograph? Silver Shutters Light Mirrors
Keith_Richards [23]

Explanation:

the reaction between silver and light creates a photograph

8 0
3 years ago
Read 2 more answers
Which two technologies support the building of single-page applications? and are two technologies helpful in building single pag
Sholpan [36]

Answer:

You can use JavaScript, HTML, PHP and so forth.

Explanation:

7 0
4 years ago
In what domain electrica energy is the most use
amm1812

Answer:the main signal bearing entities are voltage and their current in circuit environments.

Explanation:

5 0
3 years ago
Other questions:
  • The source ip address is 164.109.28.3 subnet mask of 255.255.128.0 network address is
    7·1 answer
  • Write a program that creates a dictionary containing the U.S. states as keys and their capitals as values. (Use the Internet to
    10·1 answer
  • Types of relationships include aggregation, composition, link, generalization, and specialization 9. TRUE FALSE
    9·1 answer
  • Write a program that prompts the user for the name of two files each containing a single line that represents a decimal integerc
    11·1 answer
  • Write two examples of hard copy output?​
    9·1 answer
  • To access WordPad, Jill will click on Start, All Programs, Accessories, and WordPad. To access Notepad, Karl will click on Start
    14·1 answer
  • 16. A
    15·1 answer
  • P*********** is considered a serious social problem justify this statement​
    15·2 answers
  • 26. Universal Containers (UC) has a queue that is used for managing tasks that need to be worked by the UC customer support team
    11·1 answer
  • True or false: Quality score is an algorithm that scores each of your search ads on spelling and grammar.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!