Question: Write a program which does the following. Loop 4 times, it will ask for 4 words. Inside the loop: prompt the user to type something,

Write a program which does the following.

Loop 4 times, it will ask for 4 words.

Inside the loop: prompt the user to type something, put what the user typed in a variable called s.

Print out the string in s and its length.

Initialize a variable vowelly to False.

Loop over every character c in s:

If c is a vowel a, e, I, o, or u, then set vowelly to True.

After loop, if s had any vowels then print has vowels, else print doesnt have vowels.

Initialize a variable palindrome to True

Loop over every character in s using a for loop, with range() and len() functions. The for loop variable is i.

Compare character i from the left-end to the corresponding character from the right end. If they are not equal, set palindrome to False.

(Note: leftmost char is number 0, rightmost is number -1)

After loop, print print s palindrome followed by True or False

For example, if I typed the words abba and zzyzx it would print:

abba length 4

has vowels

is palindrome True

zzyzx length 5

doesnt have vowels

is palindrome False

.

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 Databases Questions!