USING PYTHON IDLE 34 Write a Python program that prompts the

USING PYTHON IDLE 3.4:

Write a Python program that prompts the user for a message string. Based on the users entry and using Python’s string methods and capabilities, perform the following tasks:

1. Display in ALL CAPS

2. Display in all lower case replacing spaces with ‘_’

3. Display reversed

4. Display the number of spaces

5. Display the number of words

6. Display the number of vowels (A, E, I, O or U regardless of capitalization)

All in all, there are six (6) parts to this program:

1. Initialize any necessary variables

2. Prompt the user for the string to display and evaluate

3. Display modified versions of the string

i) ALL CAPS

ii) all_lower_case_replacing_spaces_with_underscores

iii) reversed

4. Count and display the number of spaces

5. Count and display the number of words

6. Count and display the number of vowels (regardless of capitalization)

Using the IDLE Python editor, enter comments in your Python program to identify each section of the code. Make sure to leave blank spaces between each comment.

The output should look like this:

NEED HELP WITH THIS PLEASE!

T This program demonstrates some of Python This program demonstrates some or Python\'s at ring manipulation capabilities. string manipulation capabilities. Enter string: You can\'t spell CHALleNGE without CHANGE Enter string: Why does this one get odd results?? YOU CAN\'T SPELL CHALLENGE WITHOUT CHANGE. WHY DOES THIS ONE GET 0DD RESULTS?? why does this one get 0dd results?? you can\'t spell challenge without changes EGNAHc ileps t nac uoY stluser ddo teg eno siht seod yhw 5 spaces in You can\'t spell cHA1 leNGE without CHANGE 8 spaces in Why does this one get odd results 7 words in Why does this one get 0dd results?? 6 words in You can\'t spell CHAlleNGE without CHANGE! 12 vowels in You can\'t spelu CHAI leNGE without CHANGE 8 vowels in why does this one get Odd results? This program demonstrates some of Python\'s string manipulation capabilities. Enter string: This is a string THIS IS A STRING this is a string irts a si 3 spaces in This is a string words in This is a string vowels in This is a string

Solution

inp = raw_input(\"Enter string:\")
print(inp.upper())
tmp = inp.lower()
print(tmp.replace(\" \",\"_\"))
print(inp[::-1])
count = str(inp.count(\" \"))
print(count+\" spaces in \"+inp)
count=str(len(inp.split()))
print(count+\" words in \"+inp)
tmp = inp.lower()
count = str(inp.count(\'a\')+inp.count(\'e\')+inp.count(\'i\')+inp.count(\'o\')+inp.count(\'u\'))
print(count+\" vowels in \"+inp)

USING PYTHON IDLE 3.4: Write a Python program that prompts the user for a message string. Based on the users entry and using Python’s string methods and capabil
USING PYTHON IDLE 3.4: Write a Python program that prompts the user for a message string. Based on the users entry and using Python’s string methods and capabil

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site