answer.
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
Alinara [238K]
2 years ago
7

python Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value i

s considered a CONSECUTIVE DUPLICATE. In this example, there are three such consecutive duplicates: the 2nd and 3rd 5s and the second 6. Note that the last 3 is not a consecutive duplicate because it was preceded by a 7. Write some code that uses a loop to read such a sequence of non-negative integers, terminated by a negative number. When the code finishes executing, the number of consecutive duplicates encountered is printed. In this case,3 would be printed. ASSUME the availability of a variable, stdin, that references a Scanner object associated with standard input.
Computers and Technology
1 answer:
Vika [28.1K]2 years ago
7 0

int firstNumber,secondNumber = -1, duplicates = 0;

do {

cin >> firstNumber;

if ( secondNumber == -1) {

secondNumber = firstNumber;

}else {

if ( secondNumber == firstNumber )

duplicates++;

else

secondNumber = firstNumber;

}

} while(firstNumber > 0 );

cout << duplicates;

You might be interested in
Which of the following commands uses correct syntax for matching the patterns bunk or bank at the end of a line of text?
Alika [10]

Answer:

a. grep 'b[au]nk$' myLine

Explanation:

grep is a command used for searching a specified pattern in a given text.

Our goal is to match the character sequence - bank or bunk at the end of line in a  given line referenced by myLine.

The regular expression for the specified match criterion is:

b[au]nk$

The second character can be either a or u.

$ indicates match at end of line.

So the overall grep command is :

grep 'b[au]nk$' myLine

8 0
1 year ago
Ryan has made a presentation of ten slides, which he wants to display in sequence after a specific time interval. Which element
alukav5142 [94]

Answer:

Slide transition.

Explanation:

PowerPoint application can be defined as a software application or program designed and developed by Microsoft, to avail users the ability to create various slides containing textual and multimedia informations that can be used during a presentation.

Some of the features available on Microsoft PowerPoint are narrations, transition effects, custom slideshows, animation effects, formatting options etc.

Basically, the views that are available on the Microsoft PowerPoint application includes;

1. Slide Sorter.

2. Notes Page.

3. Reading Pane.

4. Presenter view.

In this scenario, Ryan has made a presentation of ten slides, which he wants to display in sequence after a specific time interval.

Using slide transition in the presentation software, Ryan can make the slides appear, one after the other, after a specific time interval.

Slide transition is an inbuilt feature of a presentation software that automatically changes the slides at regular intervals.

3 0
1 year ago
At one college, the tuition for a full-time student is $8,000 per semester. It has been announced that the tuition will increase
inn [45]

Answer:

#include <iostream>

using namespace std;

 

int main () {

  // for loop execution

  int semester_fees=8000;

  int b=1;

  cout<<"there are 5 years or 10 semester fees breakdown is given below"<<endl;

  for( int a = 1; a <=5; a++ ) {

     semester_fees = semester_fees*1.03;

     cout<<"Semester fees for each of semester"<<b++<<"and"<<b++<<"is:$"<<semester_fees<<endl;

     

  }

 

  return 0;

}

Explanation:

code is in c++ language

Fees is incremented yearly and i have considered only two semester per year

3 0
1 year ago
An administrator has initiated the process of deploying changes from a sandbox to the production environment using the Force IDE
Pani-rosa [81]

Option A because the environment should be selected for which the changes are to be applied. In a time Force IDE has many project environments for example maybe a java project and C++ project would be there on sandbox, so the environment selection is important.

Option B because the related changed sets should be specified so that other developers that have access to the project can see the changes being made.

Option D The data fields that are needed to be deployed should also be provided so that the updated version can be seen by other developers.

Rejected Options :

Option C user name and password has nothing to do with the production environment because if the user has it only then it can come and make changes.

6 0
1 year ago
A(n) _________ is a document containing an organization's policies for the ethical, secure, and appropriate use of computing res
blsea [12.9K]

Answer: a) acceptable use policy

Explanation:

  • Acceptable use policy (AUP) is a policy that is regarding the usage of internet services and other network facilities with certain responsibility , rights and regulations.
  • This policy governs the internet use being done till permitted extent and is not interrupting security and ethics for any reason in corporate world, school premises etc.
  • Other options are incorrect because privacy policy is made for maintaining privacy.Fair use policy permits limited amount of copyrighted components to be used. Digital rights is related with regulation of digital element and environment.
  • Thus, the correct option is option(a).

7 0
1 year ago
Other questions:
  • Write a program that can convert an integer between 0 and 15 into hex number (including 0 and 15). the user enters an integer fr
    15·1 answer
  • Two technicians are discussing lung protection in the shop. Technician A says that respiratory-protection devices can prevent yo
    5·2 answers
  • In your own words, what is pair-programming? What is the role of the driver? What is the role of the navigator? What are some be
    15·1 answer
  • Why is the following statement true - ideally, your information is abbreviated
    10·2 answers
  • Apart from the challenges of heterogeneity, business and social change and trust and security, identify other problems and chall
    9·1 answer
  • The following checksum formula is widely used by banks and credit card companies to validate legal account numbers: d0 + f(d1) +
    13·1 answer
  • Who is currently using which computer at WP? Create an appropriate SQL query to answer this question. Show SerialNumber, Make, a
    7·1 answer
  • Design a program that asks the user for a series of names (in no particular order). After the final person’s name has been enter
    5·1 answer
  • Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each number by a space. Example
    6·1 answer
  • How does Accenture help companies harness the power of data to achieve optimal business outcomes?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!