Question
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:
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started