Created
April 5, 2014 20:40
-
-
Save ltddev/9997824 to your computer and use it in GitHub Desktop.
Pythonista Scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import console # for clear() method | |
# Notice you can list multiple files/compostion units with a single from..import statement. | |
# if the package is small you can accomplish same thing with: | |
# from calc import *. For a large package that you are importing a small subset, it is probably | |
# more efficient to import individual files either as below or with multiple imports, very similar | |
# to the way its done in Java. | |
from calc import add, subtract, multiply, divide | |
#from calc import * | |
num1 = 10 | |
num2 = 50 | |
num3 = 100 | |
num4 = 25 | |
addition = add.add_numbers(num1, num2) | |
console.clear() | |
print('The addition of ' + str(num1) + ' + ' + str(num2) + ' is: ' + str(addition)) | |
subtraction = subtract.subtract_numbers(num3, num4) | |
print('The subtraction of ' + str(num3) + ' - ' + str(num4) + ' is: ' + str(subtraction)) | |
multiplication = multiply.multiply_numbers(num1, num4) | |
print('The multiplication of ' + str(num1) + ' x ' + str(num4) + ' is: ' + str(multiplication)) | |
division = divide.divide_numbers(num3, num1) | |
print('The division of ' + str(num3) + ' / ' + str(num1) + ' is: ' + str(division)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment