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

Write a python function genRandomVect that returns a random 1d numpy array of size (50,) where each element is an integer sample

d from [0, 100) and no two elements in the vector are the same.
Your code snippet should define the following variable:

Name Type Description
genRando function function that returns a numpy array of shape (50,) that
contains random elements on the interval [0, 100) and
no duplicates
Computers and Technology
1 answer:
SSSSS [86.1K]3 years ago
6 0

Answer:

import numpy as np

def genRandomVect():

   arr = np.random.choice(range(100),size=(50,),replace=False)

   return arr

 

print("Random 1D numpy array where each element is an integer sampled from: [0, 100) ")

print( genRandomVect() )

Explanation:

  • Create a function to create a numpy array with random integers in range[0,100) with no duplicates
  • Use the random.choice to select random values from range[0,100)  and size attribute to take the size of the required array .
  • Finally return the numpy array.

You might be interested in
File Sales.java contains a Java program that prompts for and reads in the sales for each of 5 salespeople in a company. It then
myrzilka [38]

Answer:

import java.util.Scanner;

public class Sales

{

public static void main(String[] args) {

   

    int sum;

    Scanner input = new Scanner(System.in);

   

    System.out.print("Enter number of salespeople: ");

    int salespeople = input.nextInt();

    int[] sales = new int[salespeople];

       

    for (int i=0; i<sales.length; i++)

    {

     System.out.print("Enter sales for salesperson " + (i+1) + ": ");

     sales[i] = input.nextInt();

    }

    System.out.println("\nSalesperson   Sales");

    System.out.println("--------------------");

    sum = 0;

       int maxSale = sales[0];

       int minSale  = sales[0];

       int minId=1;

       int maxId=1;

    for (int i=0; i<sales.length; i++)

    {

               System.out.println("     " + (i+1) + "         " + sales[i]);

 sum += sales[i];

  if(maxSale < sales[i])

           {

               maxSale = sales[i];

               maxId = i+1;

           }

           if(minSale > sales[i])

           {

               minSale = sales[i];

               minId = i+1;

           }

   }

System.out.println("Total sales: " + sum);

       System.out.println("The average sale is: " + sum / salespeople );

       System.out.println("Salesperson "+ maxId + " had the highest sale with "+ maxSale + ".");

       System.out.println("Salesperson "+ minId + " had the lowest sale with "+ minSale + ".");

       

       int amount = 0;

       int counter = 0;

       System.out.print("Enter an amount: ");

       amount = input.nextInt();

       for (int i=0; i<sales.length; i++)

    {

     if(sales[i] > amount) {

         counter++;

         System.out.println("Salesperson "+ (i+1) + " exceeded given amount. (Number of sales: " + sales[i] +")");

     }

    }

       System.out.println("Number of salespeople exceeded given amount is: "+ counter);

}

}

Explanation:

- Ask the user for the number of salesperson

- According to entered number, create an array called sales to hold sale number for each person

- In the first for loop, assign the given sales numbers

-  In the second for loop, print all the sales people with sales, calculate the total sales. Also, find the minimum and maximum sales numbers with associated individuals.

- Print total, average, highest, and lowest sales.

- Ask user enter an amount

- In the third for loop, find the sales people who exceeded this amount.

- Print number of sales people who exceeded the amount.

8 0
3 years ago
Does anyone have a rbx account? If they do friend request Tribalchief777
Mila [183]

Answer:

ok, no because this site is for hw

Explanation:

8 0
2 years ago
Consider a hypothetical microprocessor generating 16-bit addresses with 16-bit data accesses (i.e. each access retrieves 16 bits
Vlad [161]
A. number of addresses is 65536
b. memory capacity is 128 kbytes or 131072 bytes
c. The last memory address is FFFF which is 65535

8 0
2 years ago
RDBMS stands for_________________
Aliun [14]
The term "RDBMS" stands for <span>relational database management system. 

I hope this helped! :)</span>
4 0
3 years ago
What are entity-relationship diagrams and how are they used? What symbol is used for a relationship? What is an associative enti
castortr0y [4]

Answer:

The definition including its given problem is outlined in the following segment on the clarification.

Explanation:

  • Entity-relationship (ER) diagram describes how mechanical stored procedures are constructed and demonstrate the overarching representation of the situation. It also describes the connections between some of the entities of the framework and even the comparison with standard measurements.
  • For something like an individual relationship structure, the normal representation of connections seems to be a diamond. Associative institutions have several to many partnerships to communicate with. It's indeed the verb throughout a diamond-shaped form that holds two organizations around each other. This verb is in fact an entity on its own, therefore it must be termed an associative entity.
  • An illustration of such might be if a participant were to register for a class. Multiple individuals will be registered for several courses, and there have been many to several relationships; thus, the associative object will indeed register.
4 0
2 years ago
Other questions:
  • Brian wants to conduct an online search using a certain phrase he intends to use the word books that belong to the 1800's in his
    8·1 answer
  • Which is the common name for a program that has no useful purpose, but attempts to spread itself to other systems and often dama
    14·1 answer
  • One of the most famous ___ licenses is gpl, which ensures that a particular program remains free to distribute and allows its co
    10·1 answer
  • It is always better to run over and give more information when you are giving a presentation versus quitting on time.
    11·2 answers
  • Jennifer recently bought a new computer to type a new manuscript she’s been working on. She also stored a lot of movies on it to
    10·1 answer
  • Universal Containers is implementing a community of High-Volume Community users. Community users should be able to see records a
    12·1 answer
  • Which of the following scenarios can best be addressed by operations management?
    11·1 answer
  • Your employer is opening a new location, and the IT director has assigned you the task of calculating the subnet numbers for the
    14·1 answer
  • Which camera mode gives the photographer the greatest amount of control?
    7·2 answers
  • What is the document that provides basic guidance and regulatory requirements for derivative classification
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!