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
What educational site could I make a screen capture tutorial on? I need ideas for a school project.
snow_tiger [21]

You Need Software To Screen Capture

The Software You can use is OBS its free and there are watermarks

4 0
2 years ago
Most manual-transmission vehicles use a _______ to gauge engine speed in RPMs. A. variable valve timer B. tachometer C. torque i
gavmur [86]
I believe the answer is b. tachometer

5 0
3 years ago
Sharon is thinking about opening a bakery. She knows she wants to set her own hours, reduce her stress and make a profit. But sh
kondaur [170]
C would not be a beginner move.

hope it helps
6 0
3 years ago
What set of code correctly initializes all elements of the array ar to the value 0, given the declaration
Veronika [31]

Answer:

The correct answer is:

C. ndx = 0;

while (ndx < 3) {

ar[ndx] = 0;

ndx++;

}

Explanation:

The declaration given is:

int ar[3];

This means the array consists of three locations and is named as ar.

We know that the indexes are used to address the locations of an array and the index starts from 0 and goes upto to 1 less than the size of the array which means the indexes of array of 3 elements will start from 0 and end at 2.

Now in the given options we are using ndx variable to run the while loop.

So the code to assign zero to all elements of array will be

ndx = 0;

while(ndx<3)

{

ar[ndx] = 0;

ndx++;

}

Hence, the correct answer is:

C. ndx = 0;

while (ndx < 3) {

ar[ndx] = 0;

ndx++;

}

7 0
2 years ago
In the game Singularity, broken objects can be restored to their original condition by reversing time. This is an example of whi
Zolol [24]

Solution:

In the game Singularity, broken objects can be restored to their original condition by reversing time. This is an example of which time element of player adjustment.

Thus the required answer is player adjusted.

6 0
3 years ago
Read 2 more answers
Other questions:
  • What is a stereo type?
    14·2 answers
  • You use_____ to view an XPS file
    6·1 answer
  • Radio and television are examples of
    9·1 answer
  • can you give me a tip to fix my SIM card becuaus when i put it on my phone it has no signal , can anyone fix this , thank you.​
    9·2 answers
  • What are 3 software programs for mobile computing?
    10·1 answer
  • What is the purpose of a report?
    12·2 answers
  • Which of these is not an example of a transition
    6·1 answer
  • How does a computer do its work? Mention its working principle.<br><br>​
    8·1 answer
  • The first person to say something in here will get brainliested.
    7·2 answers
  • Instructions
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!