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
aleksandrvk [35]
3 years ago
13

Write a program that (a) generates a vector with 20 random integer elements with integers between -29 and 30, (b) replaces all t

he negative integers with 100.
Computers and Technology
1 answer:
Ghella [55]3 years ago
5 0

Answer:

import random

randomlist = []

for i in range(0,20):

n = random.randint(-29,30)

if n < 0 :

n = 100

randomlist.append(n)

print(randomlist)

Explanation:

The random module is first imported as it takes care of random. Number generation.

An empty list called randomliay is created to hold the generated random integers.

Using a for loop, we specify the range of random numbers we want.

Inside the for loop ; we attach our generated random integer which will be in the range (-29 to 30) in a variable n

For each n value generated, if the value is less than 0( it is negative, since all the values are integers), replace the value with 100.

You might be interested in
3. List and explain FIVE (5) types of services performed by<br>operating system?​
leonid [27]
Memory Management
Processor Management
Device Management
File Management
Security
7 0
3 years ago
Read 2 more answers
Which category of app does word processing software fall into? A. Productivity B. Entertainment C. Social networking D. Educatio
defon
A is the answer for this question
3 0
4 years ago
Read 2 more answers
How does consumption of alcohol affect your driving skills? Name three ways that alcohol can affect your driving.
Natali [406]

Drinking and driving is not recommended. You need your, hands, feet, brain, and eyes to maneuver around. Drivers must be alert and able to make judgments quickly. Drinking and driving can affect the driver in the following ways.

Judgment

The brain is the first part of the body that is affected by alcohol. Your ability to think clearly and plan ahead levels down to as low as .02%

Concentration

Alcohol can leave you concentrating on only one action. You need to stay focused on several things at once. Alcohol will interrupt your focus and might result to an accident. Many accidents are as a result of a short attention span or a distracted driver.

Vision

Alcohol, especially when taken in excess, will impair your eye movement. Not only will it slow down your eye muscle function but  will also reduce peripheral vision.

8 0
4 years ago
Read 2 more answers
Describe the role of a chemist and the role of a chemical engineer
Andreas93 [3]
Chemist is chemist research and experiments

Chemical engineer is engineers concerned with the design and operation of industrial chemical plant
3 0
4 years ago
What was the computer works in binary functions
Mariulka [41]
Computers use binary - the digits 0 and 1 - to store data. A binary digit, or bit , is the smallest unit of data in computing.
7 0
3 years ago
Other questions:
  • What is the Web of Trust?
    12·1 answer
  • Which of these tools can best be used as a self assessment for career planning purposes
    12·1 answer
  • Maria wants to create a simple logo for her new flower shop. She would like to use the computer to create this logo. Maria shoul
    13·2 answers
  • Having plug and play support means you can plug in a device, turn on the computer, and then immediately begin using the device t
    11·1 answer
  • A low concentration of market power has positive affects. A low concentration of market share has which of the following effects
    7·1 answer
  • A polyalphabetic cipher uses many ___
    6·1 answer
  • In which of the following situations should you expect to provide your Social Security number?
    13·1 answer
  • Consider the expression 3 * 2 ^ 2 &lt; 16 5 AndAlso 100 / 10 * 2 &gt; 15 - 3. Which operation is performed second?
    6·1 answer
  • Write a program that accepts three decimal numbers as input and outputs their sum.
    10·1 answer
  • What's the difference between an exe file and an msi file? check all that apply.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!