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
kogti [31]
3 years ago
12

7.12 LAB: Contains the character

Computers and Technology
2 answers:
My name is Ann [436]3 years ago
5 0

Answer:there is Java program and C++ program

Explanation:

nalin [4]3 years ago
5 0

Answer:

The solution code is written in Python 3

  1. input_char = input("Enter a character: ")
  2. sentence = input("Enter a sentence: ")
  3. word_list = sentence.split(" ")
  4. for word in word_list:
  5.    for c in word:
  6.        if(c == input_char):
  7.            print(word)
  8.            break  

Explanation:

Firstly, use the input function to get a input character and sentence from user (Line 1 - 2)

Next, use the split method to divide the sentence into a list of individual words using single space as the delimiter (Line 4).

Create an outer for loop to traverse each word in the word_list and create another inner loop to traverse each character in the word and check if there is any character match with the input character. If so print the word and terminate the inner loop and proceed to the next round of the outer loop.

After finishing the loop, all the relevant words will be printed.

You might be interested in
What are the major benefits of preproduction?
kotegsom [21]

Some of the benefits of preproduction are that it:

  • Saves time while producing
  • Keeps you on a Budget
  • You could have more time to think about how you are going to produce your production.

Hope this could help?

4 0
2 years ago
What happens when a computer gets a virus?
Volgvan
You will start to get ad pop-ups like crazy, and your computer will be a lot slower. I'd recommend that you be careful downloading things, make sure it's the right thing you're downloading. Some people make false websites. Also the best thing to do is get a usb drive and store everything you want to keep and reset your computer to factory in your settings.
3 0
3 years ago
Read 2 more answers
There is a colony of 8 cells arranged in a straight line where each day every cell competes with its adjacent cells(neighbour).
olya-2409 [2.1K]

Answer:

I am writing a C++ program using loops instead of nested if statements.

#include <iostream> // to use input output functions

using namespace std; // to identify  objects like cin cout

void cells(int cells[],int days){ /* function that takes takes one array of integers cells, one integer days representing the number of days to simulate. */

int pos ,num=0; //declares variables pos for position of two adjacent cells and num to iterate for each day

int result[9]; //the updated output array

while (num< days)   { //this loop keeps executing till the value of num is less than the value of number of days

num++;

for(pos=1;pos<9;pos++)   //this loop has a pos variable that works like an index and moves through the cell array

    result[pos]=(cells[pos-1])^ (cells[pos+1]); //updated cell state determined by the previous and next cells (adjacent cells) by bitwise XOR operations

     for(pos=1;pos<9;pos++) //iterates through the array

         cells[pos]=result[pos];    } //the updated cells state is assigned to the cell array simultaneously

   for(pos=1;pos<9;pos++) //iterates through the array and prints the resultant array that contains the updated active and inactive cells values

        cout << result[pos]; }

int main() { //start of the main function body

int j,day;

int output[9];

*/the two cells on the ends (first and last positions of array) have single adjacent cell, so the other adjacent cell can be assumed to be always inactive i.e. 0 */

output[0]=output[9]=0;

for(j=1;j<9;j++) //takes the input array from user

cin >> output[j];

cin >> day;

cells(output,day); } //calls the function cells to print the array with active and inactive cells states.

Explanation:

The program is well explained in the comments mentioned with every statement of the program. I will explain with the help of example:

Suppose the user enters the array = [1,0,0,0,0,1,0,0] and days=1

The while loop checks if the value of num is less than that of days. Here num is 0 and days is 1 So this means that the body of while loop will execute.

In the body of while loop the value of num is incremented by 1. The first loop initializes a variable pos for position of adjacent cells. The statement is a recursive statement result[pos]=(cells[pos-1])^ (cells[pos+1]) that uses previous state for updating the state of other cells. The “^” is the symbol used for bitwise exclusive operator. In bitwise XOR operations the two numbers are taken as operands and XOR is performed on every bit of two numbers. The result of XOR is 1 if the two bits are not same otherwise 0. For example XOR of 1^0 and 0^1 is 1 and the XOR of 0^0 and 1^1 is 0. The second for loop update the cell information of all cells simultaneously. The last loop prints the updated cells states.

The main function takes the input array element from user and the value for the days and calls the cells function to compute the print the active and inactive cells state information.

The screenshot of the program along with its output are attached.

7 0
4 years ago
Today's manufacturing workplace is most likely to include
alexdok [17]

Answer:

D

Explanation: i think it's d because today technology is a big thing it would make sense if there was machinery doing the work so in that case ).Factories filled with machinery and no need for employees.

3 0
3 years ago
A user calls to report that she’s unable to log on to e-mail, and you ask a couple of questions. Because you know that no one el
FrozenT [24]

The outline of items that one must check is first to know or clarify the issue, break the issue down, etc.

<h3>What is troubleshooting?</h3>

This is known to be a step by step approach to problem handling that is often used to know and handle issues with systems etc.  

Others includes:

  • Set one's target in working on the issue,
  • Analyze the main cause,
  • Develop any form of Countermeasures.
  • Then you Implement the Countermeasures made
  • Monitor the Results that was given
  • Go through the Process to Standardize it and tell the user that it is solved.

Conclusively, By following the steps, one can know the issue and solve it.

Learn more about troubleshoot from

brainly.com/question/14394407

3 0
2 years ago
Other questions:
  • Uma organização pode ser entendida como uma instituição ou associação com objetivos predefinidos. Qual é um dos primeiros concei
    10·1 answer
  • When using the boolean data type, we encapsulate the data in what symbol?
    11·2 answers
  • What ipconfig command line option can be used to delete cached dns information from memory?​?
    9·1 answer
  • John would like to move from the city into the suburbs and has been saving up a large down payment for a home. Which is the most
    7·1 answer
  • A customer in a store is purchasing 5 items. Write a python program that asks for the price of each item and display the subtota
    14·1 answer
  • Which one of the following will not be considered as a microcomputer?
    12·2 answers
  • What kind of battery does a dji spark have?
    12·1 answer
  • What should you do if you forget your root password for MySQL?
    13·1 answer
  • A Consider the following method definition. The method printAllCharacters is intended to print out every character in str, start
    11·1 answer
  • Which statements are true? Select 4 options.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!