a=0 b=0 s="1110000" for i in range(len(s)): if s[i]=='1': a+=1 else: b+=1
this if else I need to write in one line. I tried below way it is not working.
a+=1 if if s[i]=='1' else b+=1
PLease help me on this
Aucun commentaire:
Enregistrer un commentaire