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
Get step-by-step solutions from verified subject matter experts
