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
Before inserting a preformatted table of contents, what must you do first?
vova2212 [387]

Answer: apply heading styles to text.

Explanation:

6 0
3 years ago
________ is used for supervisory messages at the internet protocol layer.
Natalija [7]
"ICMP" <span>is used for supervisory messages at the internet protocol layer.
ICMP stands for </span>Internet Control Message Protocol and it refers to a supporting protocol in the Internet protocol suite. It is utilized by network devices which includes routers and these are used to send error messages and operational data showing, for instance, that asked for service which isn't accessible or that a host or switch couldn't be come to.
4 0
3 years ago
Who's YouTube creator?
snow_tiger [21]


ok there were more than one founders

chad hurley

jawed karim

and steve chen


YouTube was found in 2005 February the 14th

ok all of the founders or known as creators are those three men uptop

hoped his helped you

4 0
3 years ago
Read 2 more answers
Triangle O N M is cut by line segment L K. Line segment L K goes from side N O to side N M. The length of N L is x, the length o
Fantom [35]

Answer:

D) x=8

Explanation:

4 0
4 years ago
Read 2 more answers
How does Frankenstein feel about his creation?
velikii [3]

Answer:

he just regrets that he made a monster and deeply feels guilty that it is in pain of reliving

Explanation:

8 0
4 years ago
Other questions:
  • Need answers for 11&amp;12. Due today. Thanks.
    14·1 answer
  • _____ view focuses on the text and content of a document, without much information on the page layout
    15·1 answer
  • Discuss what they need to consider if they wish to use their devices when they are away from home?
    6·1 answer
  • Slicing can best be described as
    9·1 answer
  • Write a program that reads a stream of integers from a file and writes only the positive numbers to a second file. The user shou
    5·1 answer
  • A database administrator (DBA) must have a clear understanding of the fundamental business of an organization, be proficient in
    11·1 answer
  • What are two constraints that continuous-media files have that conventional data files generally do not have?
    12·1 answer
  • What are the steps to creating a blank database? Use the drop-down menus to complete them.
    9·1 answer
  • Using the Insert tab, you can convert text into a table and a table into text.
    15·1 answer
  • How to transfer polygon from eth to polygon in ledger live
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!