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 is objective reporting?
stira [4]
Objective reporting is reporting that separates facts and opinion.
7 0
3 years ago
Write a function (named n_pointed_star) to make the turtle draw an n-pointed star. The function should return nothing, and accep
Andreyy89

Answer:

import sys

import turtle

import random

def n_pointed_star(total_points):

if total_points <= 4:

 raise ValueError('Not enough total_points')

area = 150

for coprime in range(total_points//2, 1, -1):

 if greatest_common_divisor(total_points, coprime) == 1:

  start = turtle.position()

  for _ in range(total_points):

   turtle.forward(area)

   turtle.left(360.0 / total_points * coprime)

  turtle.setposition(start)

  return

def greatest_common_divisor(a, b):

while b != 0:

 a, b = b, a % b

return a

   

turtle.reset()

n_pointed_star(5)

Explanation:

  • Inside the n_pointed_star function, check whether the total no. of points are less than or equal to 4 and then throw an exception.
  • Loop through the total_points variable and check whether the result  from greatest_common_divisor is equal to 1 or not and then set the starting position of turtle and move it.
  • Create the greatest_common_divisor which takes two parameters a and b to find the GCD.
  • Finally reset the turtle and call the n_pointed_star function.
8 0
3 years ago
The questions are in the pictures, i basically have to create a web page, drop the html code and files below thank you.
matrenka [14]

This contains pretty much what you need:


<!DOCTYPE html>



<html>


<head>


   <meta charset="utf-8" />


   <title>The Page Title</title>


</head>


<body>



   <h1>First paragraph</h1>


   <p>This is a paragraph of text.</p>


   <h2>Second level paragraph</h2>


   <p>


       Here is an unordered list of options:


       <ul>


           <li>First</li>


           <li>Second</li>


           <li>Third</li>


       </ul>


       Here is another unordered list of options:


       <ul>


           <li>First</li>


           <li>Second</li>


           <li>Third</li>


       </ul>


       Here is an ordered list of options:


       <ol>


           <li>First</li>


           <li>Second</li>


           <li>Third</li>


       </ol>


   </p>


   <h4>Third level</h4>



</body>


</html>

3 0
3 years ago
Pointers are addresses and have a numerical value. You can print out the value of a pointer as cout &lt;&lt; (unsigned)(p). Writ
lukranit [14]

Answer:

#include <iostream>

using namespace std;

int main() {

  int i = 2;

  double j = 3;

 

  int *p = &i;

  double *q = &j;

 

  cout << "p = " << p << ", p+1 = " << p+1 << endl;

  cout << "q = " << q << ", q+1 = " << q+1 << endl;

  return 0;

}

Explanation:

In C++, pointers are variables or data types that hold the location of another variable in memory. It is denoted by asterisks in between the data type and pointer name during declaration.

The C++ source code above defines two pointers, "p" which is an integer pointer and "q", a double. The reference of the variables i and j are assigned to p and q respectively and the out of the pointers are the location of the i and j values in memory.

8 0
3 years ago
A certain computer can be equipped with 268,435,456 bytes of memory. Why would a manufacturer choose such a peculiar number inst
Arte-miy333 [17]

Answer:

Computer system use Binary and it uses power of 2 only.

Explanation:

The reasons for equipping memory with a peculiar number instead of round or even number are as follows:

  • The computer system uses the power of 2 instead of the power of 10 to equipping memory and hence use a number like 250,000,000 is not possible.
  • The computer systems work on the memory where 1 MB or 1 megabyte shows as 1024 kb or 1,048,576 bytes.
  • In computer system memory capacity is always some multiply of 1024 bytes.
  • Hence, 268,435,456 bytes of memory shows 256 MB of memory.

5 0
3 years ago
Other questions:
  • What is the difference between pulse code modulation and delta modulation? Provide examples.
    11·1 answer
  • "the file that specifies how netbeans builds and deploys the application when you run the application is called the ____________
    8·1 answer
  • Do most facebook and twitter users access the platform from their personal computers?
    6·2 answers
  • An example of an email client is:<br> A.)Yahoo<br> B.)Gmail<br> C.)Outlook<br> D.)All of the Above
    9·1 answer
  • Credibility means that the reader perceives value in what you write.<br> True False
    12·1 answer
  • Web and mobile applications are created for users to only read information. True False
    15·2 answers
  • The operating system is not responsible for allowing one computer to share information with other computers.
    15·2 answers
  • If your pulse is higher than your Target Heart Rate during exercise, what should you do?
    5·2 answers
  • Explain the<br>4 ways<br><br>ways of arranging icons.<br><br>​
    6·1 answer
  • One problem with _______ is that often many copies of the same document are made. <br><br>HELPPP ​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!