Flip Bit
Python
Easy
2 views
Problem Description
Read integer b (0 or 1), flip it (0 becomes 1 and 1 becomes 0). Output flipped value.
Input Format
One integer b.
Output Format
One integer.
Constraints
b is either 0 or 1.
Official Solution
import sys
s=sys.stdin.read().strip()
if not s: sys.exit(0)
b=int(s)
sys.stdout.write('1' if b==0 else '0')
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!