x='00101'
Given a string x consisting of only '0' and '1' with length 5 as above (the value of x is not the same as above). Just an example)
y='11010'
Write a program to find a string y whose digit values of x are converted to '0' and '1' to '0' as shown above.
python
x = '000010'
y = ''
for i in x:
y += str(int(i) ^ 1)
print (y)
It seems good to do your homework on your own.
>>> x = '00101'
>>> y = str(int('1' * len(x)) - int(x)).zfill(len(x))
>>> y
'11010'
581 GDB gets version error when attempting to debug with the Presense SDK (IDE)
560 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
823 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
558 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.