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 the first and last names, i.e., letters that only appear in one name but not the other name. Letters in the three strings should be sorted alphabetically. Ignore case. Example: nameSet('George', 'Washington') will return ('aeghinorstw', 'go', 'aehinrstw').
def nameSet(first, last):
setF = set(first.lower())
setL = set(last.lower())
result1 = list(setF.union(setL))
result2 = list(setF.intersection(setL))
result3 = list(setF.symmetric_difference(setL))
result1.sort()
result2.sort()
result3.sort()
res1 = ''.join([str(x) for x in result1])
res2 = ''.join([str(x) for x in result2])
res3 = ''.join([str(x) for x in result3])
return (res1, res2, res3)
# Testing
print(nameSet('George', 'Washington'))


In python,write a function nameSet(first, last) that takes a person's first and last names as input,...
Python 3.7.3 ''' Problem 3 Write a function called names, which takes a list of strings as a parameter. The strings are intended to represent a person's first and last name (with a blank in between). Assume the last names are unique. The function should return a dictionary (dict) whose keys are the people's last names, and whose values are their first names. For example: >>> dictionary = names([ 'Ljubomir Perkovic', \ 'Amber Settle', 'Steve Jost']) >>> dictionary['Settle'] 'Amber' >>>...
1. Write a function to keep asking the user for names in the form of strings, sort alphabetically and store these names into a text file named names.txt 2. Write a function that accepts a string as the argument, removes all alphabetical letters from the string, and returns it 3. Write a function that accepts a file name in the form of a string as the argument. Assume the text file contains single-digit numbers and letters. Read the entire contents...
Write a program that reads a person's first and last names, separated by a space. Then the program outputs last name, comma, first name. End with newline. Example output if the input is: Maya Jones Jones, Maya import java.util.Scanner; public class SpaceReplace { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); String firstName; String lastName; //answer goes here// } }
Write a program that reads a person's first and last names, separated by a space. Then the program outputs last name, comma, first name. End with newline. Example output if the input is Maya Jones Tones, Maya import java . util·Scanner; public class SpaceReplace 4 public static void main (String [1 ares) f( Scanner scnr-new Scanner(System.in); String firstName; String lastName; Your solution goes here */ 10 12
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,...
In python: ScoreFinder is a function that takes in two lists and a string. The first list is a list of strings (player names), the second list is a list of floats (player scores), and the string is a name (player to find). If the player to find exists in the list of player names, then print the name of that player along with their associated score (which is in the second list at the same index). If the player...
Write only a python function definition for a function that takes two strings values as its parameters , and if the first parameter alphabetically comes later in a dictionary than the second parameter then the function returns the length of the first parameter, otherwise the function returns the negative of the length of the second parameter. Name your function fA. For instance : fA(“do”,”can”) returns 2
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...
Problem 1 In this problem, you will write two functions. The first function takes in a string and returns that string without any dashes. The second function takes in the first and last name and returns a string that is lastname_firstname and uses the previous function to remove any dashes (-) in the name. Note that you’ll be testing it by calling it from the command line; you’ll call it from a script in problem 3. Deliverables: Function file that...
#APA citation style cites author names like this: # # Last, F., Joyner, D., & Burdell, G. # #Note the following: # # - Each individual name is listed as the last name, then a # comma, then the first initial, then a period. # - The names are separated by commas, including the last # two. # - There is also an ampersand and additional space before # the final name. # - There is no space or comma...