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
Aliun [14]
3 years ago
14

Create a function named test2Problem2that contains a list comprehension. This function will take asingle integer parameter nand

returns a list of length n of every other prime. (Please note that primes start at 2.)There will be a 10 point deduction for not using a list comprehension to solve this problem.List comprehensions have this form: [ expression for item in list if conditional ]In:10Out:[2,5,11,17,23,31,41,47,59,67]In:7Out:[2,5,11,17,23,31,41]
Computers and Technology
1 answer:
ikadub [295]3 years ago
3 0

Answer:

C++.

Explanation:

#include <iostream>

using namespace std;

/////////////////////////////////////////////////////////

void printPrime(int n) {

   if (n > 0) {

       cout<<"[2";

       for (int i=3; i<=n; i++) {

           bool isPrime = true;

           

           for (int j=2; j<i; j++) {

               if (i % j == 0) {

                   isPrime = false;

                   break;

               }

           }

           

           if (isPrime == true)

               cout<<", "<<i;

       }

   }

   else {

       cout<<"Invalid input";

   }

   cout<<"]";

}

/////////////////////////////////////////////////////////

int main() {

   int n;

   cout<<"Enter positive integer: ";

   cin>>n;

   printPrime(n);

   return 0;

}

You might be interested in
Which Creative Commons license type allows others to use and build upon work non-commercially, provided that they credit origina
Vera_Pavlovna [14]

Answer:

Creative Commons license type allows others to use and build upon work non-commercially, provided that they credit original author and maintain the same licensing is described below in detail.

Explanation:

Attribution-Non financially-ShareAlike

This permission lets others adapt, remix, and develop upon your work non-financially, as long as they charge you and license their new inventions under identical times. There are six separate license classes, scheduled from most to least licensed. the material in any mechanism or arrangement, so long as attribution is given to the originator.

8 0
3 years ago
A bin contains 100 sty le a notebooks, 100 style b notebooks, and 100 style c notebooks. antoine will select 3 notebooks from th
emmasim [6.3K]
<span>The answer is Ten.  Substituting numbers for letters, available selections are 111, 112, 113, 122, 123, 133, 222, 223, 233, 333.  Note that, for example, 112, 121, and 211 are considered as the same selection.
</span>AAA, BBB, CCC, <span>AAB, AAC, </span><span>BBC, </span><span>ABB, ACC, </span><span>CCB & ABC.</span>
7 0
4 years ago
This isn't a homework question but rather a technological problem. I connected my device to the motherboard but it will not dete
Helen [10]
Re start the computer again
5 0
4 years ago
Read 2 more answers
True or False <br><br> MAC addresses are assigned by the router along with your IP address.
Oduvanchick [21]
True. If you look at the router it will correspond with your MAC address
4 0
3 years ago
A group within a portfolio comprised of subprograms, projects or other work that are managed in a coordinated fashion in support
saveliy_v [14]

Answer: Program

Explanation: Program is basically a collection of projects and sub programs. The management of this group of related projects is more useful than managing the individual projects. Program manager keeps track of the program. Program focuses throughout on the organisation benefits and needs for which it was initiated. For example in a vehicle company the design of a specific car is a program and its parts like engine, brakes, bonnet etc are called projects.  

4 0
3 years ago
Other questions:
  • Int a=10 int b=20<br> A=b<br> The new values for a and b are
    11·2 answers
  • Write a program that prompts the user to enter: The cost of renting one room The number of rooms booked The number of days the r
    14·1 answer
  • The user does not need to highlight data within an Excel worksheet in order to remove conditional formatting. True or false
    14·1 answer
  • A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To ac
    5·2 answers
  • Which of the following statements comparing debit cards to credit cards is TRUE?
    13·2 answers
  • Knowing and understanding the targeted audience is a main compnent to creating a website
    15·1 answer
  • True/False? In association rule learning, the following two rules will always have the same support value.
    9·1 answer
  • What is the full form of cpu​
    11·2 answers
  • How do i copy a canvas course from old class to new course.
    12·1 answer
  • Which of the following describes evolution in the SDLC model?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!