Forums
New posts
Search forums
News
Security News
Technology News
Giveaways
Giveaways, Promotions and Contests
Discounts & Deals
Reviews
Users Reviews
Video Reviews
Support
Windows Malware Removal Help & Support
Inactive Support Threads
Mac Malware Removal Help & Support
Mobile Malware Removal Help & Support
Blog
Log in
Register
What's new
Search
Search titles only
By:
Search titles only
By:
Reply to thread
Menu
Install the app
Install
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Guides
Programming Guides & Questions
Bitwise XOR Calculation Troubleshooting
Message
<blockquote data-quote="quentisa" data-source="post: 1054235" data-attributes="member: 98424"><p>Hello there,</p><p>I'm attempting to construct XOR logic in Python, but my code is failing me. I want to accept two boolean inputs from the user and then utilise logical operators to determine the XOR result. However, my code does not appear to be producing the desired results like this example from scaler. Could you please assist me in determining what is wrong?</p><p></p><p>This is my code:</p><p>[CODE]num1 = int(input("Enter the first integer: "))</p><p>num2 = int(input("Enter the second integer: "))</p><p></p><p># Calculate XOR</p><p>result = num1 ^ num2</p><p></p><p>print("Bitwise XOR result:", result)[/CODE]</p><p>Whatever values I input, the output is consistent and does not appear to be the right XOR result. Is there something I'm missing regarding logical operators or their precedence? Your assistance would be much appreciated!</p></blockquote><p></p>
[QUOTE="quentisa, post: 1054235, member: 98424"] Hello there, I'm attempting to construct XOR logic in Python, but my code is failing me. I want to accept two boolean inputs from the user and then utilise logical operators to determine the XOR result. However, my code does not appear to be producing the desired results like this example from scaler. Could you please assist me in determining what is wrong? This is my code: [CODE]num1 = int(input("Enter the first integer: ")) num2 = int(input("Enter the second integer: ")) # Calculate XOR result = num1 ^ num2 print("Bitwise XOR result:", result)[/CODE] Whatever values I input, the output is consistent and does not appear to be the right XOR result. Is there something I'm missing regarding logical operators or their precedence? Your assistance would be much appreciated! [/QUOTE]
Insert quotes…
Verification
Post reply
Top