Skip to content

Commit

Permalink
Create two_simple_examples
Browse files Browse the repository at this point in the history
Add a Python Program to add 2 numbers OpenGuide#1
  • Loading branch information
mattrudo committed Oct 11, 2017
1 parent 28278a9 commit e418f6b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions SimpleAddition/two_simple_examples
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Two simple examples of adding two numbers
# They are designed to be implemented within a .py file
# They would need the addition of raw input to run from the
# command line
# Also note that the float version does not round, just
# dropping all numbers after a decimal. This is not always
# practical, but good for teaching


# python function to add two numbers
def addTwoNumbers(firstnumber, secondnumber):
sum = float(firstnumber) + float(secondnumber)
return sum

# python function to add two Integers
def addTwoIntegers(firstnumber, secondnumber):
sum = int(firstnumber) + int(secondnumber)
return sum

0 comments on commit e418f6b

Please sign in to comment.