Question: How do I take out the comma from the last letter in the result? 1 #Vancouver citation style cites author names like this: 3 #
How do I take out the comma from the last letter in the result?


1 \#Vancouver citation style cites author names like this: 3 \# Last F, Joyner D, Burdell G 4 \# 5 \#Note the following: 6 \# 7 \# - Each individual name is listed as the last name, then a 8 \# space, then the first initial. No periods or commas within 10 \# - The names are separated by commas, including the last 11 \# two. 12 \# - There is no space or comma following the last period. 14 \#vrite a function called names to vancouver. names to vancouver 15 \#should take as input a list of strings, and return a single 16 \#string according to the style given above. You can assume 17 \#that each item of the list will be a first and last name: 18 \#no middle initials. For example: 19 \# 22 \#....would return "Last F, Joyner D, Burdell G ".. 24 Hurite your function below! def names to vancouver (alist): empty = Ti: for name in range(len(alist)): item = alist [name]. split(' ) if item = = len(alist) 1 : empty t=item[1]++item[][0] else: empty += item [1]++item[0][0]+ return empty \#Below are some lines of code that will test your function. * You can change the value of the vartable(s) to test your 10 \# - The names are separated by commas, including the last 11 \# two. 12 \# - There is no space or comma following the last period. 13 \# 14 Flirite a function called names to vancouver. names to vancouver 15 Hshould take as input a list of strings, and return a single 16 \#string according to the style given above. You can assume 17 \#that each item of the list will be a first and last name: 18 tho middle initials. For example: 19 \# 20 \# names,to_vancouver(["First Last", "David Joyner", "George Burdell"]) 21 \# 22 \#...would return "Last F, Joyner D, Burdell G. \#Nrite your function below! def names to vancouver (alist): empty = for name in range(len (alist)): item = alist[name].split(' ') if item ==len(a1 ist )1:. else: empty + =item[1] ++ item [0][0]+, return empty 38 \#below are some lines of code that will test your function. 39 =You can change the value of the variable(s) to test your 40 =function with different inputs. 41 \# 42 \#If your function works correctly, this will origina11y 43 \#print: Last F, Joyner D, Burdel1 6 4 print(names_to_vancouver(["First_Last", "David Joyner", "Gearge Burdel1"]))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
