Python for beginners:
https://www.youtube.com/watch?v=egq7Z..
Code:
l=int(input());
i=0;
m=[];
zeros=0;
while(i<l):
y=int(input());
if(y==0):
zeros+=1;
m.append(y);
i+=1;
i=0;
while(i<l):
if(i<zeros):
m[i]=0;
else:
m[i]=1;
i=i+1;
print(m);
Telegram: https://t.me/clcoding_python
https://www.facebook.com/pirawenpython/
https://www.facebook.com/groups/piraw...
https://www.youtube.com/watch?v=egq7Z..
Code:
l=int(input());
i=0;
m=[];
zeros=0;
while(i<l):
y=int(input());
if(y==0):
zeros+=1;
m.append(y);
i+=1;
i=0;
while(i<l):
if(i<zeros):
m[i]=0;
else:
m[i]=1;
i=i+1;
print(m);
Telegram: https://t.me/clcoding_python
https://www.facebook.com/pirawenpython/
https://www.facebook.com/groups/piraw...
0 Comments:
Post a Comment