Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Your Python program should perform the following three tasks: 1. After getting a

ID: 3671324 • Letter: Y

Question

Your Python program should perform the following three tasks:

1. After getting a word of input from the user (i.e., any string), your program should use a while (or for) loop to print out each of the letters of the word. Just remember that strings in Python start with element 0!

2. Your program should then use another loop to print out each of the letters of the (same) word in reverse order!

3. Ask the user for a letter (one specific character in the word) to count. Use another loop to count how many times that letter appears in the original word. Print out this count

Explanation / Answer

#if raw_input is giving error then use input
word = raw_input("Enter a word ")
for i in word:
    print i

print " Printing character in reverse order:"
for i in word[::-1]:
    print i

ch = raw_input(" Enter a character to find::")
count = 0

for i in word:
    if i == ch:
        count = count + 1

if count==0:
    print "Your character " + ch + " does not appeared in word "+word
else:
    print "Your character " + ch + " appeared " + str(count) + " time in word "+word

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote