0

i input two Names having first name and last name, but this code is not printing both names ? can anyone help?

https://code.sololearn.com/cuHi46OIQxND/#py input Muhammad Ahad yes Muhammad Imran OutPut MuhammadImran

8th Mar 2019, 3:11 PM
Muhammad Ahad
Muhammad Ahad - avatar
5 odpowiedzi
+ 2
And what is the problem again? It seems to work correctly, it outputed all names. Only problem was when you inputed two names with same firstname and different lastname.
8th Mar 2019, 3:19 PM
Maneren
Maneren - avatar
+ 1
Because you set up variable (object property) with name like "firstname" and asign value like "lastname". So with second name with same firstname it owerwrites the previous.
8th Mar 2019, 3:48 PM
Maneren
Maneren - avatar
+ 1
You're welcome
8th Mar 2019, 4:10 PM
Maneren
Maneren - avatar
0
Oh i was putting same first name all the time.. sorry to bother you.. but why it dont work with same first name..
8th Mar 2019, 3:36 PM
Muhammad Ahad
Muhammad Ahad - avatar
0
ohh... i got it.. same key ,so it assign it to a new value.. thanks for helping.. 😊
8th Mar 2019, 3:51 PM
Muhammad Ahad
Muhammad Ahad - avatar