def greet(x,y):
z=[]
z=x.append(y)
return "Hi your ful name is : %s \n your firstname: %s \n lastname: %s" %(z.title(),x,y)
f_name=[]
l_name=[]
f_name=list(input("enter your firstname : "))
l_name=list(input("entere your lastname: "))
print(greet(f_name,l_name))
Asked
Active
Viewed 31 times
0

Mohammed Azim
- 1
- 2
-
Is your goal just to print first name and last name in a string? – Shadab Hussain Mar 20 '20 at 06:49
-
i want to append the string in list – Mohammed Azim Mar 20 '20 at 12:40
-
You want something like `z = f'{x} {y}'`; there's no need for any lists in this code. `f_name` and `l_name` should just be simple `str` values. – chepner Mar 20 '20 at 13:26
1 Answers
-1
This happens because when we use x.append(y), the operation is performed on x and hence nothing is returned when we append() as it happens when we use sort() with a list.Hence z is None type object

Mehul Gupta
- 1,829
- 3
- 17
- 33
-
-
How?? both x & y are lists as both inputs are converted to lists as & when taken from the user. Hence z is also a list i guess!! – Mehul Gupta Mar 20 '20 at 13:07
-
-