0

Why is it giving syntax error for creating empty set

https://code.sololearn.com/cRW6oW6720pP/?ref=app

14th Dec 2020, 4:43 AM
Amit Kumar
Amit Kumar - avatar
9 ответов
0
Amit Kumar Corrected code ------ x=list(input()) y=[] z=[] print (x) for i in x: j = int(i) if j % 2 == 0: y.append(j) elif j % 2 != 0: z.append(j) else: print("somthing unexpected happened") print("".join([str(i) for i in y]), 'are the even integers') print("".join([str(i) for i in z]), "are the odd integers")
14th Dec 2020, 4:54 AM
A͢J
A͢J - avatar
+ 1
Amit Kumar You missed one closing braces ) at first line.
14th Dec 2020, 4:46 AM
A͢J
A͢J - avatar
+ 1
Ohhhhh thank you so much
14th Dec 2020, 4:48 AM
Amit Kumar
Amit Kumar - avatar
+ 1
Amit Kumar One more thing don't write anything inside input () otherwise it will append in list. Just do x = list(input ())
14th Dec 2020, 4:50 AM
A͢J
A͢J - avatar
+ 1
Thank you soo much
14th Dec 2020, 4:55 AM
Amit Kumar
Amit Kumar - avatar
+ 1
Amit Kumar I have edited my previous reply. You can do this to join list of integer print("".join([str(i) for i in y]), 'are the even integers') print("".join([str(i) for i in z]), "are the odd integers")
14th Dec 2020, 4:59 AM
A͢J
A͢J - avatar
0
I Am Groot ! I am unable to use " ".join() on int type
14th Dec 2020, 4:51 AM
Amit Kumar
Amit Kumar - avatar
0
What else can I use to join the list
14th Dec 2020, 4:51 AM
Amit Kumar
Amit Kumar - avatar
0
Line 6 and 8
14th Dec 2020, 4:51 AM
Amit Kumar
Amit Kumar - avatar