+ 1

Please explain this code?

s='sololearn' for i in s [print(i if ('a'<i) else 0,end=")]

19th Jul 2020, 1:30 PM
Ankit Kumar
Ankit Kumar - avatar
6 Respuestas
+ 2
The for loop iterates through the string. For each letter in SoloLearn, you do the following. If it occurs after 'a', then print it. Else print 0. The end='' tells that there shouldn't be a break after the output. So this should output: solole0rn 'a' doesn't come after 'a'. So, it is replaced with 0.
19th Jul 2020, 1:37 PM
Arnesh
Arnesh - avatar
+ 2
Bro! This code will show error, I think.
19th Jul 2020, 1:52 PM
Jaya Singh
Jaya Singh - avatar
+ 2
Jaya Singh I thought I was the only one seeing this🤔🤔
19th Jul 2020, 1:53 PM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 2
Jaya Singh That's right, code has syntax errors
19th Jul 2020, 2:02 PM
Ipang