Using string functions and methods Write a program that will do the following: i
ID: 3639728 • Letter: U
Question
Using string functions and methodsWrite a program that will do the following:
input a string from the user (keyboard)
With a for loop, print out every other letter in the string, starting from the beginning, all on the same line.
With a for loop, print out every letter in the string backwards starting from the right end, all on the same line.
With an if statement, print out the string if its length is more than 5 characters long. It will print the word "short" if the string is 5 characters or less.
With an assignment statement, create a new string based on the input string, which is formed from the first 2 characters of the string followed by the last 2.
With an if statement, create a new string based on the input string. The new string is the old string with "ing" added at the end of it if the old string does not already end with "ing". if it does end in "ing" the code should add "ly" instead. Note that this says end in "ing".
Example run:
Enter a string: abcdf
Every other character
acf
String backward
fdcba
short
first and last 2 characters abdf
new string with suffix abcdfing
Explanation / Answer
Hi! Cramster Terms & Conditions were changed recently (I hope you have read them). Now, experts have to send the answers to askers' inbox after you rate them. That is because of people copying from older threads which have public answers. Hence we can only send the answer after you rate. So please give me a Lifesaver rating and I'll send the solution to your inbox or e-mail. You've got no other option to get the answer, because no one can give you the answer over here. Even you might be banned for rating a user that gave the answer directly on your question. You need not worry as I have the solution ready in my notebook. Hope you rate me :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.