Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Python program that asks the user to input a string and then prints out that string in Title Case. That is, the first

Write a Python program that asks the user to input a string and then prints out that string in Title Case. That is, the first letter of each word is uppercase and the remainder of the word is lowercase. If the entire word is two letters long, the entire word is lowercase. The three-letter words “and,” “the,” and “not” are all lowercase while all other three-letter words are capitalized. The first word in the string is capitalized. If the user enters the string the following strings:

The quick brown dog and the

The program should print out:

The Quick Brown Dog and the

So this is what I got:

student submitted image, transcription available below 

def what2 capitalize (word): skipList = ['and', 'the', 'not'] if word not in skipList: return word.capitalize() return word S = input ("Type in any string: ") print (s.title())

Step by Step Solution

3.43 Rating (159 Votes )

There are 3 Steps involved in it

Step: 1

er for cc ug share Y ing stions N DED AIP urveys mainpy 1 def w... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions

Question

Consider the boolean expression((x > 10) || (x Answered: 1 week ago

Answered: 1 week ago