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
Roman55 [17]
4 years ago
15

This function takes in a string of letters separated by commas. You can # assume that the string s contains only english letters

in lower-case & # separated arbitrarily by commas. # # This function examines each string fragment that are separated by commas. # If any of the fragments contains the same letter repeated exactly MAX_DIGIT # times it returns True. Otherwise, it returns False. #
Computers and Technology
1 answer:
ololo11 [35]4 years ago
7 0

Answer:

Check the explanation

Explanation:

def has_triggers(string):

 

### split() splits the string using comma and store them in a list li

   li=string.split(",")

 

### iterate through the list and find the size of 5

   for i in range(len(li)):

     

## # if the length is > 0 and the all the 5 characters are same then returns true.

       if(len(li[i])>0 and li[i]==li[i][0]*5):

           return True

     

   return False

###calling function by passing the input string and prints the returned value

print(has_triggers('a,aaaa,aaaaa,a'))

print(has_triggers('ab,xxxxx,yxyx,m'))

print(has_triggers('ab,xx,xx,yxyx,n'))

print(has_triggers('ab,pppppppppp,qq'))

print(has_triggers(',abc,abc,abc,,,'))

You might be interested in
In 1956, the unit byte was coined by American statistician and computer scientist John Tukey
Sever21 [200]

Answer:

False

Explanation:

John Wilder Tukey was an American mathematician and statistician, best known for the development of the Fast Fourier Transform (FFT) algorithm and box plot. The Tukey range test, the Tukey lambda distribution, the Tukey test of additivity, and the Teichmüller–Tukey lemma all bear his name. He is also credited with coining the term 'bit' and the first published use of the word software.

4 0
3 years ago
Ben is writing a paper for his college history class, and he wants to include some information he found on a Web site. What are
aliina [53]

Answer and Explanation:

Ben needs to cite his source of information when including information from the Web in his academic paper. A common citation method that he could use to cite his source is APA style.

When citing a website using APA style of references, you need to include the author, the title of the page or article, the date of publication, , the website name, and the URL(ususally in brackets).

4 0
3 years ago
Lol WAKE UP!!! and get ready to answer my questions.
deff fn [24]

Answer:

<h2>1. Variable Creation Statement</h2><h2>2. Fav_Num=7</h2>

Explanation:

<h2><em>Hope This Helps :)</em></h2><h2>Im not sure if the 2nd one is correct but i think that it is.</h2>
5 0
3 years ago
What was your first pokemon game<br><br><br> if you have not played one just comment don't answer
d1i1m1o1n [39]

Answer:

FireRed & LeafGreen

Explanation:

5 0
3 years ago
Read 2 more answers
Write a C program (doublecopy) that allows a user to extract some part of an existing file (fileSource) and copy it twice to a n
Slav-nsk [51]

Answer:

Check the explanation

Explanation:

#include <stdio.h>

#include <sys/stat.h>

#include <stdlib.h>

#include <fcntl.h>

#include <errno.h>

#include <unistd.h>

extern int errno;

struct stat st;

int main(int argc, char **argv){

  int num1 = atoi(argv[1]); // Getting num1 from user

  int num2 = atoi(argv[2]); // Getting num2 from user

  char *fileSource = argv[3];

  char *fileTarget = argv[4];

 

  int source_fd = open(fileSource, O_RDONLY); // opening the file in read only mode

  int target_fd = open(fileTarget, O_WRONLY | O_CREAT); // opening the target file in Writeonly mode if file is not found it will create

   

  char *ch = (char *) calloc(num2+num1, sizeof(char));

 

  stat(fileSource, &st);

  if(st.st_size < (num1 + num2)){

      printf("File Size is smaller than the specified bytes\n");

      read(source_fd, ch, st.st_size); // reading the file upto the end

      write(target_fd, ch, st.st_size); // write to the file

      write(target_fd, ch, st.st_size); // two times writing to the file

  }else{

      if(lseek(source_fd, (off_t)num1, SEEK_SET) < 0 ) // moving the cursor to after the specified bytes from the start

      {

          printf("Some Error occured while seeking the file");

          return -1;

      }

      read(source_fd, ch, num2); // reading num2 bytes from the source

      write(target_fd, ch, num2); // writing two times to the target

      write(target_fd, ch, num2);

     

  }

 

  return 0;

 

}

1 2 #include <stdio.h> #include <sys/stat.h> #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> 4

The code screenshot and code output are attached below.

3 0
3 years ago
Other questions:
  • A company has decided to re-introduce a retro-radio by reproducing a product that was manufactured in the 1940s. The company has
    5·1 answer
  • âwhat two log files are used by older versions of unix and newer version of linux to store log information
    10·2 answers
  • Peter accumulated many photos from his visit to Wisconsin. He wants to upload these photos to a social networking site. Which fi
    12·1 answer
  • Kash has created a document that needs to be protected. only certain users should be able to open the document. what option shou
    5·1 answer
  • When someone makes a bad or immoral decision because a group of their friends is also doing it, it is called:
    10·1 answer
  • True or false A job analysis weight the positives and negative of a given career
    13·1 answer
  • Aarti, a museum employee, has created a table in access titled “Roman Achitecture”. She has included a field that links users im
    8·1 answer
  • Turns on her laptop and gets the error message "OS NOT FOUND." She checks the hard disk for damage or loose cable, but that is n
    11·1 answer
  • From your analysis, do you think you’ve seen all of the servers and hosts that make up the Amazon e-commerce site? How does Amaz
    12·1 answer
  • Your development team is planning to host a development environment on the cloud. This consists of EC2 and RDS instances. This e
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!