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
er for cc ug share Y ing stions N DED AIP urveys mainpy 1 def w... View full answer
Get step-by-step solutions from verified subject matter experts
