help on half adder python - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

help on half adder python

srk619srk619 Posts: 2Member
need help on this question:

Draw up the list of possible inputs for a half adder and the
outputs that you expect. Implement a half adder in a few lines of python, so that the
variables o1 and o2 are based on i1 and i2.

i1= True
2 i2= False
3 ............................
o1 =?
5 o2 =?

now i know the function should be something like this :h(i1, i2) =>o1, o2


i have come up with some coding but dont know the formula to put in and how to make all the coding work.


def half_adder(i1, i2):
o1 = # need formula here
o2 = # need formula here
return o1, o2
Sign In or Register to comment.