Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need help fixing this python code We'll say that a triple in a string is a character that appears three times in a row.

image text in transcribedi need help fixing this python code
We'll say that a triple in a string is a character that appears three times in a row. Triples may overlap. For example, the string "AAAXBBBBxyz' contains three triples. Write code that counts the number of triples in a string named text and stores the result in a variable named triple_count. Assume that the variable text already has a value. prev char count + 1 if (prev_char_count >= 3): triple_count + 1 else: prev_char count = 1 prevoius_char = text[index] 13 print(triple count) Check My Solution Load My Latest Solution [Reset Test Results: You're using a variable named triple_count. The result is correct for the string 'abcdef". X The result is not correct for the string 'zzz'. The result is not correct for the string 'xxxx'. * The result is not correct for the string 'abcXXXdefYYYghizzzjki'. X The result is not correct for the string 'tttttttttttt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

=+2. Do they use a similar tone of voice and point of view?

Answered: 1 week ago

Question

Evaluate three pros and three cons of e-prescribing

Answered: 1 week ago

Question

Project management skills and/or experience desirable

Answered: 1 week ago