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
The domain in an email message tells you the
Alexus [3.1K]
The type of service provider
8 0
3 years ago
Consider an array inarr containing atleast two non-zero unique positive integers. Identify and print, outnum, the number of uniq
Delvig [45]

Answer:

Program.java  

import java.util.Scanner;  

public class Program {  

   public static boolean isPalindrome(String str){

       int start = 0, end = str.length()-1;

       while (start < end){

           if(str.charAt(start) != str.charAt(end)){

               return false;

           }

           start++;

           end--;

       }

       return true;

   }  

   public static int countPalindromePairs(String[] inarr){

       int count = 0;

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

           for(int j=i+1; j<inarr.length; j++){

               StringBuilder sb = new StringBuilder();

               sb.append(inarr[i]).append(inarr[j]);

               if(isPalindrome(sb.toString())){

                   count++;

               }

           }

       }

       return count == 0 ? -1 : count;

   }

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       String line = sc.next();

       String[] inarr = line.split(",");

       int count = countPalindromePairs(inarr);

       System.out.println("RESULT: "+count);

   }

}

Explanation:

OUTPUT:

3 0
3 years ago
To accomplish a certain task when you would rsther be doing something else is an example of
fenix001 [56]

Answer:

Self Discipline

Explanation:

his is because you train your brain to do the right thing.

I hope I helped. Thank you for your time.

6 0
3 years ago
Digital learning can help students who enjoy
mr Goodwill [35]

Answer:

flexibility and independence

Explanation:

6 0
2 years ago
Which item is used for formatting in responsive web design?
taurus [48]

Answer:

3) Improving image quality

Explanation:

A responsive web design is a web design that makes website to be user friendly to website users. It enables the users to have an optimal and enjoyable experience when making use of websites.

A responsive web design is the basis on which websites are built. It makes websites interactive for users such that that find the websites easy to access, easy to read and very interactive.

Computer programs used for creating a responsive web design are:

a) JavaScript

b) Cascading Style Sheets e.t.c

The item used for formatting a responsive web design is Improving Image quality. This helps to make the website responsive for users.

3 0
3 years ago
Other questions:
  • Which of the following would likely be covered under homeowners insurance but NOT by renter's insurance?
    9·2 answers
  • Help me Please?!! I will put you as brainliest.<br>I hope I spelled that right.
    5·2 answers
  • A network engineer arrives at work and discovers that many users are having problems when attempting to connect to the company n
    9·2 answers
  • While a hard drive is running, even a slight bump against the computer may cause the
    9·2 answers
  • "The term ____ refers to the programs or instructions used to tell the computer hardware what to do."
    6·1 answer
  • Read the excerpt from The Code Book. Other attacks include the use of viruses and Trojan horses. Eve might design a virus that i
    13·1 answer
  • When you gather primary or secondary data, what part of the market information management process are you participating in?
    8·1 answer
  • What do you think is the most fascinating aspect of the internet?
    7·2 answers
  • Suppose the message 111010 is to be transmitted (beginning with the leftmost bit) using
    6·1 answer
  • Which types of attacks are thwarted by complex passwords that are combinations of upper and lower case letters, numbers, and spe
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!