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
Vikentia [17]
3 years ago
8

What expressions will initialize d with a random value such that all possible values for d are given by the inequality 1.5 ≤ d &

lt; 7.5?
Computers and Technology
1 answer:
Kaylis [27]3 years ago
7 0

Answer:

The solution code is written in Python

d = 1.5 + random.random() * 6

Explanation:

By presuming the Python random module is imported, we can use the <em>random</em> method to generate a random number.  <em>random.random()</em> will give us a value in the range [0, 1). The ensure the lower limit is 1.5 instead of 0, we can add 1.5 to random.random()

  •      1.5 + random.random()

This expression will give any value in range [1.5, 2.5)

To ensure the upper limit is set to 7.5, we tweak the previous expression to

  • 1.5 + random.random() * 6  

This expression will always multiply a random number from [0,1) with 6 and then only added with 1.5. This will always produce a random number that fulfill the inequality 1.5 ≤ d < 7.5

You might be interested in
A program that will read each player’s name and golf score as keyboard input,
PtichkaEL [24]
Use for loop and question inside it
7 0
3 years ago
The exploitation of a buffer-overrun vulnerability in an application will MOST likely lead to:_________
SashulF [63]

Answer:

A. Arbitrary code execution

Explanation:

A buffer-overrun, also known as buffer overflow occurs when a programmer makes an error during coding, which could make his system easily susceptible to attacks from a hacker. The root cause of this problem is an overflow of data in a buffer, and programs that are written in C and C+ + are more likely to be affected by this problem.  When a buffer-overrun occurs, it would most likely lead to arbitrary code execution.

Arbitrary code execution is an uncontrolled and unrestricted coding by the attacker which alters the original coding. The attacker could input more information into the coding, which alters the original information and which would make the application porous and accessible by just anyone. It is important that programmers run regular tests on their programs, so as to detect any coding errors.

8 0
3 years ago
Examples of domain names and usernames<br><br><br><br>​
svp [43]

Answer:

examples are:

com or .edu is a top-level domain name (TLD)

cornell.edu is a second-level domain name (SLD)

bigred.cornell.edu is a third-level or three-part domain name

project.bigred.cornell.edu is a fourth-level or four-part domain name

hope this helps you.

4 0
3 years ago
When did economies begin?
Pavlova-9 [17]
They began in ancient times the babylons started trading
6 0
3 years ago
Read 2 more answers
Questions about the data policy and privacy policy of YT
Ilya [14]

Answer:

I'm confused

Explanation:

7 0
3 years ago
Other questions:
  • What does rwd stand for?
    8·2 answers
  • Which of the following is true about images that are arranged in a collumn
    9·1 answer
  • What is a main cause of an aurora?
    8·1 answer
  • __________ contain(s) remnants of word processing documents, e-mails, Internet browsing activity, database entries, and almost a
    9·1 answer
  • How many of the colonists of Jamestown died before they made it to shore, due to the difficult voyage?
    15·1 answer
  • Dora has inserted a text box into a Word document that she is formatting. Which strategy will not format text boxes? Create a li
    6·2 answers
  • List the two page orientations in Microsoft word​
    10·1 answer
  • Match the ernerging technologies to their descriptions.
    14·1 answer
  • Which of the following is NOT an example of soft skill?
    10·2 answers
  • Edhesive assignment 1 movie ratings
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!