How to Add Binary Numbers in Python

preview_player
Показать описание
This video explains how to add two binary numbers in python.
Two approaches are discussed.
1. Direct approach
2. using bin built-in function
Logic of binary addition is explained with example.

other interesting videos:
Link for add and subtract two binary numbers

Link for Python Excel Automation Part 1 -Read and write in Excel

Link for Automate WhatsApp messages using python

Link for how to convert JSON to CSV using Python

Link for Convert list to JSON Python

Link for Build your first mobile app in Python

Link for Display MySQL data in python table :Treeview with horizontal scrollbar

Link for how to connect python with MySQL

Link for text to speech conversion using python

For more python videos:

For cryptography related videos:

Subscribe for more new videos:

Thanks for your support,
#Trinitysoftware
#pythonbinaryaddition
#leetcode67
Рекомендации по теме
Комментарии
Автор

for i in range(length-1, -1, -1):
sum = int(a[i]) + int(b[i]) + carry
if sum >= 2:
carry = 1
sum -= 2
else:
carry = 0
result = str(sum) + result
# If there's still a carry after iterating through all the digits, add it to the beginning of the result
if carry == 1:
result = "1" + result
return result

how is this ?

pallantibunny
join shbcf.ru