SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 305 Weeks Ago, 1 Day Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 14 Nov 2017 My Price 10.00

until the user presses enter without entering anything.

Use Python 3.6 to create a program called CountConsecutiveChars

 

1. it reads strings from the user until the user presses enter without entering anything.

2. it reports the number of characters that appear consecutively in the string more than once (lets call that a "run")

3. it also prints the length of the largest run.

 

For example if the String is: "aaxbbb", then the sum of all characters that were repeated consecutively is 5 because 'a' repeats 2 times and 'b' repeats 3 times. The largest run was 3 (the b's).

 

You cannot use topics we haven't covered yet. For instance, in this case you cannot use indexing of strings (chapter 10). For example: str[0] is the first character of string str, str[1] is the second, etc.

 

Note: This is chapter 7. We cannot use anything pass chapter 7 from the book. Python book has been attached. Please test project using CountConsecutiveChars_Test.py to make sure it passes all the test.

 

Examples of runs:

% python3 CountConsecutiveChars.py 

enter a string: abc

>>>count 0

>>>max 0

enter a string: aabc

>>>count 2

>>>max 2

enter a string: aaabc

>>>count 3

>>>max 3

enter a string: aaaabcc

>>>count 6

>>>max 4

enter a string: aaaaabbc

>>>count 7

>>>max 5

enter a string: abcccc

>>>count 4

>>>max 4

enter a string:

Attachments:

Answers

(5)
Status NEW Posted 14 Nov 2017 08:11 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)