Question

please convert a lost of names(like "First Last") into a list of lower case usernames with...

please convert a lost of names(like "First Last") into a list of lower case usernames with the format "flast"

example:

names = ["John Doe", "John Smith"]

prints

['jdoe', ' jsmith]

python please.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
names = ["John Doe", "John Smith"]
result = []
for x in names:
    splits = x.split(" ")
    result.append(splits[0][0].lower()+splits[1].lower())
print(result)

['jdoe', 'jsmith']
Add a comment
Know the answer?
Add Answer to:
please convert a lost of names(like "First Last") into a list of lower case usernames with...
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
  • This is for a class in C++ Problem 1: A class Names reads the following names...

    This is for a class in C++ Problem 1: A class Names reads the following names from the .txt file Name.txt [Insert a long list of first, middle and last names. Each set of names is placed on a different line like the following: John Doe Jane Doe Johnie Boy etc.] Make a search directory using dynamic allocation (pointers) where the user would search the any number of letters of the first name and the matching name/names would come up...

  • In python,write a function nameSet(first, last) that takes a person's first and last names as input,...

    In python,write a function nameSet(first, last) that takes a person's first and last names as input, and returns a tuple of three strings: the first string gives the union of all letters in the first and last names (no duplication though). The second string gives the intersection of letters in the first and last names, i.e. the common letters. If there are no common letters, then the second string is empty (''). The third string gives the symmetric difference between...

  • 12. If column A is a column of last names and column B is first names,...

    12. If column A is a column of last names and column B is first names, then the formula to enter into C that can be copied and will result in First Name Last Name is: 1 Last Name First Name 2 Jones Sally 77722 Smith Kathy 4 Martha Buller a. =B2+A2 b. =B2&" "&A2 C. =B2+""+A2 d. =$B2+A$2 e. None of the above 13. The default format for Text in Excel is: a. Right justified b. Center justified c....

  • A person's initials consist of the first letter (in upper case) of each of their names....

    A person's initials consist of the first letter (in upper case) of each of their names. For example, the initials of Alan Mathison Turing are AMT. Use loops to print out all possible initials for people who have exactly three names. Cycle through the letters of the first initial first, followed by the middle initial, and then the last initial. Python Programming A person's initials consist of the first letter (in upper case) of each of their names. For example,...

  • SortAndSearch.cpp – Objectives: Binary Search and Selection sort You are given a list of 20 names...

    SortAndSearch.cpp – Objectives: Binary Search and Selection sort You are given a list of 20 names as follows: {"Collins, Bill", "Smith, Bart", "Michalski, Joe", "Griffin, Jim",                         "Sanchez, Manny", "Rubin, Sarah", "Taylor, Tyrone", "Johnson, Jill",                         "Allison, Jeff", "Moreno, Juan", "Wolfe, Bill", "Whitman, Jean",                         "Moretti, Bella", "Wu, Hong", "Patel, Renee", "Harrison, Rose",                   "Smith, Cathy", "Conroy, Pat", "Kelly, Sean", "Holland, Beth"}; Write a program to sort and display the names in alphabet order (use selection sort). The program prompts...

  • Write a program that prompts the user to enter a list of names. Each person's name...

    Write a program that prompts the user to enter a list of names. Each person's name is separated from the next by a semi-colon and a space (: and the names are entered lastName, firstName (i.e. separated by ',). Your program should then print out the names, one per line, with the first names first followed by the last names. A sample run of your program should look like Please enter your list of names: Epstein, Susan; St. John, Katherine;...

  • 1. Write a program to input a list of names (strings) from the user and store...

    1. Write a program to input a list of names (strings) from the user and store them in an ArrayList. The input can be terminated by entering the empty string or by entering the string “quit”. 2. Add further functionality to your program so that it searches the ArrayList to find the first string and the last string according to dictionary ordering and then prints out these strings (names). Do this exercise without sorting the names in the ArrayList. For...

  • Q1: Given a message “explanations” a) Define a key, which is a combination of last names...

    Q1: Given a message “explanations” a) Define a key, which is a combination of last names of all team members. For example, for a team of two persons ‘John Smith’ and ‘John Li’ the key will be ‘SmithLi’. You will use this key for encryption and decryption below b) First encrypt the message using Vigenère cipher. Encrypt the resulting cipher-text using Playfair cipher. c)Decrypt the ciphertext from part b above. Hint: First decrypt using Playfair cipher and then decrypt it...

  • Write a Python program to create userids: You work for a small company that keeps the...

    Write a Python program to create userids: You work for a small company that keeps the following information about its clients: • first name • last name • a user code assigned by your company. The information is stored in a file clients.txt with the information for each client on one line (last name first), with commas between the parts. In the clients.txt file is: Jones, Sally,00345 Lin,Nenya,00548 Fule,A,00000 Your job is to create a program assign usernames for a...

  • Do in Python Problem 2 Assume s is a string of lower case characters. Write a...

    Do in Python Problem 2 Assume s is a string of lower case characters. Write a program that prints the number of times the string ' lol' occurs in s For example, if s= 'azclololegghakl', then your program should print S Number of times lol occu rs is: 2 Problem 3 Assume s is a string of lower case characters Write a program that prints the longest substring of s in which the letters occur in alphabetical order. For example,...

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