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
yawa3891 [41]
3 years ago
10

Write a script that will generate random integers in the range from

Computers and Technology
1 answer:
barxatty [35]3 years ago
5 0

Answer:

Explanation:

Let's do this in Python, we shall use the package random to generate a random double between 0 and 1. Then we multiply it with 50 and covert to integer to get a random integer between 0 and 50. Place a While function with condition to stop when it's greater than 25

from random import random

attempts = 1

random_int = int(random()*50)

print(random_int)

print("This is attempt " + attempts)

while random_int <= 25:

    attempts += 1

    random_int = int(random()*50)

    print(random_int)

    print("This is attempt " + attempts)

You might be interested in
What's usually kept in database?
Levart [38]
I think this is the answer. I tried. Databases<span> may be </span>stored<span> on a computer and examined using a programs.</span>
7 0
3 years ago
Read 2 more answers
When creating databases, the different pieces of information are input into _______.
Tanya [424]
Fields. This one had me in doubt. Different kinds of information go into different database tables. A table contains rows (=records) made up of fields. So a field is the smallest "thing" in a database (much like a cell in a spreadsheet). So yes, I'd say fields is the correct answer.
4 0
3 years ago
Clunker Motors Inc. is recalling all vehicles in its Extravagant line from model years 1999-2002 as well all vehicles in its Guz
Aleksandr [31]

Answer:

The following code is written in java programming language:

//set if statement

if (((modelYear >= 1999) && (modelYear <= 2002) && (modelName == "Extravagant")) || ((modelYear >= 2004) && (modelYear <= 2007) && (modelName == "Guzzler")))

{

recalled = true;    //initialized Boolean value

}

else      //set else statement

{

recalled = false; ////initialized Boolean value

}

Explanation:

Here, we set the if statement and set condition, if the value of modelYear is greater than equal to 1999 and less that equal to 2002 and modelName is equal to "Extravagant" or the value of modelYear is greater than equal to 2004 and less than equal to 2007 and the model year is equal to "Guzzler", than "recalled" initialized to "true".

Otherwise "recalled" initialized to "true".

5 0
3 years ago
Papa Mario of Mario's Pizzeria has baked a huge pizza and cut it into n slices, but he is clumsy and the pizza wasn't evenly sli
rosijanka [135]

Suppose there are n student: 1, 2, 3, ..., i, ..., n.

Now, let's say each want slice size to be: t1, t2, ..., ti, ..., tn.

Let's pizza slices be : s1, s2, ..., si, ..., sn.

Now, it can be said that a student ' i ' will accept a slice of pizza ' si ' only if the size of slice is more then ' ti '.

Logic to distribute: what can be done is we can sort the demand i.e ti of students and also sort the size of pizza slices si. Now, Papa Mario can distribute the sorted slices to students sorted demand(smallest to heighest) one by one as they appear in sorted lists. Now, it will only be possible to distribute the slices to make everyone happy, if and only if in sorted lists of both s and t for each index k, it holds the condition: tk <= sk.

Let me explain you with example:

Lets says size of whole pizza is 100.

Now number of students n = 4.

Let there demands be : 20, 35, 15, 10.

This means 1st student atleast require the slice size of 20 and so on.

Case 1: Papa Mario divides the pizza into slices of size: 25, 20, 20, 35.

=> Now, we sort both lists.

Thus t => 10, 15, 20, 35

and s => 20, 20, 25, 35

Now, as we can see that for all index  tk <= sk, hence pizza can be distrubeted so that everyone can be happy.

Case 2: Papa Mario divides the pizza into slices of size: 30, 20, 20, 30.

=> Now, we sort both lists.

Thus t => 10, 15, 20, 35

and s => 20, 20, 30, 30

Now, as we can see that, for last student with demand of 35, the pizza slice alotted is of size 30, thus he is unhappy, and pizza cannot be distributed so that everyone becomes happy.

Now, after the approach, let's discuss question.

(a) Greedy algorithm paradigm is most appropriate for this problem, as what we are doing is greedily distributing small slices to those students which have least demands first then tackling bigger demands of students, by remaining bigger slices.

(b) As we are mainly sorting thel ist of sizes of pizza slices and student demands, thus we need to use an efficient algorithm to sort the lists. Such an efficient algorithm can be QuickSort() or MergeSort().

(c) Asymptotic running time of our algorithm would be O(n*logn).

3 0
3 years ago
What type of memory or storage device is prone to losing data if the power goes out?
Veseljchak [2.6K]
The answer is (c.) a DDR SDRAM module.

DDR SDRAM stands for Double data rate synchronous dynamic random-access memory. It is a form of temporary data storage in a computer. So when it comes to power down, the data stored in this RAM is most likely to lose.
7 0
3 years ago
Other questions:
  • Java - Given a String variable response that has already been declared, write some code that repeatedly reads a value from stand
    12·1 answer
  • JAVA
    7·1 answer
  • Assume that the main method of the class named Welcome does not contain any compile-time errors. What is the name of the file ge
    11·1 answer
  • which internet technology allows businesses to make presentation and share visual aids such as charts and graphs
    14·2 answers
  • Which of the following is a technology designed for use in manufacturing?
    15·1 answer
  • How did New York Governor Hugh Carey handle Sostre’s situation?
    9·2 answers
  • WHAT IS THE LOCATION OF “A”. ON THE GRID?
    15·2 answers
  • What are the possible consequences of plagiarism?
    15·1 answer
  • Join the class <br> The class code is hello112
    5·2 answers
  • Blockchain is often associated with Bitcoin and the financial services industry. However, it is applicable to almost every indus
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!