+ 1
Please explain this code?
s='sololearn' for i in s [print(i if ('a'<i) else 0,end=")]
6 Answers
+ 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.
+ 2
Bro! This code will show error, I think.
+ 2
Jaya Singh I thought I was the only one seeing thisđ€đ€
+ 2
Jaya Singh
That's right, code has syntax errors