Question: Write a program that asks the user for 15 letters, accumulates them into a single string variable, and prints the string. Here is a sample

Write a program that asks the user for 15 letters, accumulates them into a single string variable, and prints the string.

Here is a sample run of the program:

Please enter a letter: I Please enter a letter: l Please enter a letter: o Please enter a letter: v Please enter a letter: e Please enter a letter: P Please enter a letter: y Please enter a letter: t Please enter a letter: h Please enter a letter: o Please enter a letter: n Please enter a letter: ! Please enter a letter: ! Please enter a letter: ! Please enter a letter: ! The string is: IlovePython!!!! 

Hint: As for running totals where we initialize the variable to 0, for variables that "accumulate" strings, we initialize the variable to the empty string ("").

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!