1: Compare output A Output differs. See highlights below. Special character legend Input Your output Expected output 2: Compare output Lee 18 Lua 21 Mary Beth 19 Stu 33 -1 18, L. Lee 194 Lua 22 Mary 04 Stu 344

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

ive try this code and did the inputs and its not right . can someone help me ,,

 

fullName=str(input())
##List is for storing firstname,middlename,lastname separately,List is initially an empty list
List=[]
##Take an empty string word
word=""
##Start traversing fullName
for char in fullName:
    ##If any character is a space(' ') then,add the string stored in word variable in List
    if(char==' '):
        List.append(word)
        ##And again make word an empty string
        word=""
    ##Otherwise,add current character with word
    else:
        word=word+char 
##After completing this for loop,add the string stored in word variable in List
List.append(word)
##result will store the final result,it is initially an empty string
result=""
##If there are only firstname and lastname then,
if(len(List)==2):
    ##Add lastname then add ", " then add first character of firstname then add ".", with result
    result=List[1]+", "+List[0][0]+"."
##If there are firstname,middlename and lastname then,
elif(len(List)==3):
    ##Add lastname then add ", " then add first character of firstname then add "." then add first character of middle name again add "." with result
    result=List[2]+", "+List[0][0]+"."+List[1][0]+"."
##Now,display the result
print(result)

Only show failing tests
1: Compare output
Output differs. See highlights below. Special character legend
Input
Your output
Expected output
2: Compare output
Input
Your output
Lee 18
Lua 21
Mary Beth 19
Stu 33
-1
Expected output
18, L.
Output differs. See highlights below. Special character legend
Lee 194
Lua 22
Mary 04
Stu 344
Laura 63
Vaishnavi 24
Sarah Sims 33
-1
63, L.
Laura 644
Vaishnavi 25
Sarah 04
Download this submission
0/1
0/3
Transcribed Image Text:Only show failing tests 1: Compare output Output differs. See highlights below. Special character legend Input Your output Expected output 2: Compare output Input Your output Lee 18 Lua 21 Mary Beth 19 Stu 33 -1 Expected output 18, L. Output differs. See highlights below. Special character legend Lee 194 Lua 22 Mary 04 Stu 344 Laura 63 Vaishnavi 24 Sarah Sims 33 -1 63, L. Laura 644 Vaishnavi 25 Sarah 04 Download this submission 0/1 0/3
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY