Question

1. Given any word x (e.g. 'sTrInG'), how to make only the first letter upper case,...

1.

  1. Given any word x (e.g. 'sTrInG'), how to make only the first letter upper case, and all other letter lower case?
  2. Given a list of words such as list_word = ['MS-Word','MS-Excel','Target','Walmart'……], please write a one line command to extract a sublist that only contains the items starting with 'MS'
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The answer to this question is as follows in python:

The code is as follows:

The answer to the first question is:

s=input()
print(s.capitalize())

The answer to the second question is as follows:

list=['MS-Word','MS-Excel','Target','Walmart']
for i in list:
if(i.startswith('MS')):
print(i)

Add a comment
Know the answer?
Add Answer to:
1. Given any word x (e.g. 'sTrInG'), how to make only the first letter upper case,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a function that, given a word and a set of characters, filters all occurrences of...

    Write a function that, given a word and a set of characters, filters all occurrences of those characters from the word. For e.g. remove_chars("abcdeeeeefmnop", "ebo") returns: acdfmnp i.e all occurrences of e, b and o have been removed from abcdeeeeefmnop You should acquire the word and set of characters both from the user and then pass them to the function. Note: std::cin terminates when it encounters a space, you should take the word and character set as separate inputs: std::cin...

  • *****Requiremrnt: 1. Please do not use any array or arraylist 2. collects only a single String...

    *****Requiremrnt: 1. Please do not use any array or arraylist 2. collects only a single String input 3. uses at least 3 String methods 1) Just Initials: Print just the initials in upper case letters separated by periods 2) Last Name First With Middle Initial: Print the last name in lower case with the first letter capitalized, followed by a comma and the first name in in lower case with the first letter capitalized and then the middle initial capitalized...

  • Goal:   Unscramble permuted words by generating all permutations of Jumble string and searching for a word...

    Goal:   Unscramble permuted words by generating all permutations of Jumble string and searching for a word in Unix dictionary. Unix Dictionary: dict.txt Details: Write a method called get_permutations that inputs a string like "dog". Your method should return an array of all permutations of the Jumble string. . For example: s = "dog" perms = get_permutations(a) print(perms) Output: ['dog', 'dgo', 'odg', 'ogd', 'gdo', 'god'] Rewrite the script for obtaining permutations and the end of the Comments, Hints, and Observersions section...

  • Write Java program: • Is at least 8 characters long • Contains at least 1 lower letter charact...

    Write Java program: • Is at least 8 characters long • Contains at least 1 lower letter character • Contains at least 1 upper letter character • Contains at least 1 numeric digit • Contains at least 1 special character from the set: !@#$%^&* • Does not contain the word “and” or the word “the” Prompts the user for a password, including the requirements above in your output. Output a string that states valid or invalid. If invalid, state which...

  • PLEASE WRITE SIMPLE JAVA PROGRAM AND ALSO EXPLAIN THE LOGIC. Given a string, print the first...

    PLEASE WRITE SIMPLE JAVA PROGRAM AND ALSO EXPLAIN THE LOGIC. Given a string, print the first word which has its reverse word further ahead in the string. Input Format: A string of space separated words, ending with a 's'. Conditions ; Each string ends with a $ character. All characters in the string are either spaces. $ or lower case English alphabets, Output Format : In a single line pent either . The first word from the start of the...

  • A java program for this question please! Recursion: A word is considered elfish if it contains...

    A java program for this question please! Recursion: A word is considered elfish if it contains the letters: e, l, and f in it, in any order. For example, we would say that the following words are elfish: whiteleaf, tasteful, unfriendly, and waffles, because they each contain those letters. Write a recursive method called elfish(), that, given a word, tells us whether or not that word is elfish. The signature of the method should be: public static boolean elfish(String word)...

  • The program needs to be written in C. Write a function void camelCase(char* word) where word...

    The program needs to be written in C. Write a function void camelCase(char* word) where word consists of more than two words separated by underscore such as “random_word” or "hello_world_my_name_is_sam". camelCase() should remove underscores from the sentence and rewrite in lower camel case” (https:// en.wikipedia.org/wiki/Camel_case). Watch out for the end of the string, which is denoted by ‘\0’. You have to ensure that legal strings are given to the camelCase() function. The program should only run when the input is...

  • Pythong Program 4 should first tell users that this is a word analysis software. For any...

    Pythong Program 4 should first tell users that this is a word analysis software. For any user-given text file, the program will read, analyze, and write each word with the line numbers where the word is found in an output file. A word may appear in multiple lines. A word shows more than once at a line, the line number will be only recorded one time. Ask a user to enter the name of a text file. Using try/except for...

  • From the Tony Gaddis text, the chapter on C-String and Class String: String Length: Write a...

    From the Tony Gaddis text, the chapter on C-String and Class String: String Length: Write a Function that passes in a C-String and using a pointer determine the number of chars in the string.                                           Data:   “This is a test string for string length” Prt String Backwards: Write a Function that passes in a C-String and prints the string backwards.      Data: “This is a test string for string backwards” replaceSubstring: Write a Function that accepts three C-Strings – str1,...

  • Recursion and Trees Application – Building a Word Index Make sure you have read and understood...

    Recursion and Trees Application – Building a Word Index Make sure you have read and understood ·         lesson modules week 10 and 11 ·         chapters 9 and 10 of our text ·         module - Lab Homework Requirements before submitting this assignment. Hand in only one program, please. Background: In many applications, the composition of a collection of data items changes over time. Not only are new data items added and existing ones removed, but data items may be duplicated. A list data structure...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT