Computer Science, asked by seenasureshkmd, 10 months ago

Write a python program that takes your full name as input and displays the abbreviations of the first and middle names except the last name which is displaye
For example, if your name is Robert Brett Roser, then the output should be R.B.Roser.

Answers

Answered by akshayamca14
6

Answer:

def abbrevate_name(name):

   x=name.split()

   return (x[0][0:1]+'.'+x[1][0:1]+'.'+x[2])+'.'

fname=input("Enter Fullname: ")

fname=abbrevate_name(fname)

print(fname)

Explanation:

Answered by syed2020ashaels
0

Explanation:

# This is a python program that takes a person's full name as input and displays the abbreviations of the first and middle names except the last name which is completely or fully displayed

def full(st1):

  # Here, the string is split to form the list

  lst = st1.split()

  # An empty variable is initialized

  space = ""

  # Here, the list is traversed completely

  for i in range(len(lst)-1):

     st1 = lst[i]

  # Here the first letter of the name is added in upper case letters

     space += (st1[0].upper()+'.')

  # l[-1] is used to denote the last entry into lst1

     space += lst[-1].title()

  return space

# Now, the main printing is done here          

st1=input("Enter name: ")

print("Abbreviated name is : ",full(st1))        

Learn more here

https://brainly.in/question/13352712

Learn more

https://brainly.in/question/48907088

Similar questions