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
NemiM [27]
4 years ago
10

Write a python code that creates a numpy array of 10 randomly generated values between 0 and 100.

Computers and Technology
1 answer:
Harlamova29_29 [7]4 years ago
8 0

Answer:

import random  #random to generate random integers.

import numpy as np #numpy to create a numpy array.

lis=[]#empty list.

random.seed()#seed to generate every time differnt random integers.

for i in range(10):#looping 10 times.

   a=random.randint(0,101)#generating random numbers.

   lis.append(a)#inserting into the lis list.

np_lis=np.array(lis)#converting lis to numpy array.

print(np_lis)#print the numpy array.

Explanation:

The above-written code generates a numpy array of 10 randomly generated integers.I have first created an emmpty list lis.To generate random numbers we have import random library.random.seed is used so that every time distinct random number are generated.The for loop is run 10 times.In for loop random number generated is stored in the variable a then it is added to the list lis.Then after the loop finishes the lis list is converted to numpy array np_lis.

You might be interested in
Which of the following statements is true?
jeka57 [31]

Answer: Constructors can specify parameters but not return types.

Explanation:

public class Student {

 int roll_no;

 public Student(int a) {

   roll_no = a;

 }

public static void main(String[] args) {

   Student abs = new Student(10);

   System.out.println(abc.roll_no);

 }

}

In the above code we have illustrated the working of constructors. We have a class with the name Student. then a constructor is created of the class called as the class constructor. In the main we create an object of the class and with this object we invoke the constructor and also pass a parameter. Here in the code we are passing the roll no of the student.

So we can say that constructor is called during the runtime when the object created invokes the constructor so a constructor can have many arguments but it does not have a return type.

7 0
3 years ago
When a style set has been inserted in a document, the spacing of the style set can be easily changed.?
Stells [14]
Yes that statement is correct. 
7 0
4 years ago
Whenever you communicate online, remember a. to delete anything you don't want to keep b. everything you put online is available
maxonik [38]

Answer:

B-Everything you put online is available forever. Messages or photos will never be permanently deleted from memory cards on cameras or cell phones.

5 0
3 years ago
Which of the following is NOT essential for individuals to have to build their own web page?
natali 33 [55]
Linux. You do not need Linux as an operating system for your website.
5 0
4 years ago
Objects both in the real world and in object-oriented programming contain ____ and methods.
larisa86 [58]

Objects both in the real world and in object-oriented programming contain <u>attributes</u> and methods.

<h3>What is an attribute?</h3>

In Computer technology, an attribute can be defined as a unique characteristic or quality which primarily describes an entity in a software program.

<h3>What is a method?</h3>

In Computer programming, a method can be defined as a block of executable code (sets of instruction) that are written and used by programmers to break down a given problem into small but manageable fragments (pieces).

This ultimately implies that, methods are typically written and used by programmers to break down any complex problem into simple and manageable fragments (pieces). Also, all modern programming languages comprises several methods that are predefined.

In this context, we can infer and logically deduce that all objects both in the real world and in object-oriented programming generally contain <u>attributes</u> and methods.

Read more on methods here: brainly.com/question/25619349

#SPJ4

6 0
2 years ago
Other questions:
  • Which of the following is a good choice to help you stay organized when you are away from the office? A. Personal Information ma
    7·1 answer
  • Is there any level after genius?
    8·1 answer
  • A bakery collects data on sales. Each sales record includes the date of the sale and some metadata about the items that were par
    11·1 answer
  • Which type of business is best for Juanita to start? a corporation, because she needs a large investment to get started a sole p
    13·2 answers
  • Successful implementation of an effective MRP system depends upon (1) the recognition of the difference between independent and
    13·1 answer
  • Does anyone know websites that have free to use images, such as the website "wikimedia"? I like that one the best but it doesn't
    5·1 answer
  • Match the different stages of boot sequence with the order in which they occur.​
    15·2 answers
  • PLEASE HELP ASAP (answer is needed in Java) 70 POINTS
    15·1 answer
  • Which group contains the command to manually conduct a spell check ?
    9·1 answer
  • Dwayne wants a variable called "name" to appear in the interpreter and does not want a space after it. Which of these should be
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!