コード例 #1
0
ファイル: second.py プロジェクト: MbqIIB/python-batches
#!/usr/bin/python
# using modules we are not worried about other programs namespaces.

import sys
sys.path.insert(
    0,
    '/home/khyaathi/Documents/git_repos/python-batches/batch-66/10-modules/extra'
)

import first as f


def my_add(a, b):
    ''' This is for adding numbers only '''
    a = int(a)
    b = int(b)
    return a + b


# Main
if __name__ == '__main__':
    print "addition of two numbers is {}".format(my_add(11, 22))
    print "addition of two strings is {}".format(f.my_add("linux", " rocks"))
コード例 #2
0
#!/usr/bin/python

import sys
sys.path.insert(
    0,
    '/home/tcloudost/Documents/git_repositories/python-batches/batch-62/modules/extra'
)

import first as f


def my_add(a, b):
    '''
		I want to add two integers.
	'''
    a = int(a)
    b = int(b)
    return a + b


# Main
if __name__ == '__main__':
    print "addition of two integers is {}".format(my_add(1, 2))
    print "addition of two strings is {}".format(f.my_add("python", "rocks"))
コード例 #3
0
#!/usr/bin/python

# /home/khyaathi/Documents/git_repos/python-batches/batch-65
# automate the above path
# hint : os module
import sys
sys.path.insert(
    0,
    '/home/khyaathi/Documents/git_repos/python-batches/batch-65/modules/extra')
import first as f


def my_add(a, b):
    ''' this is for addition of number '''
    a = int(a)
    b = int(b)
    return a + b


if __name__ == '__main__':
    print "the addition of two numbers is {}".format(my_add(1, 2))
    print "the addition of two string is {}".format(f.my_add('linux', 'rocks'))
コード例 #4
0
ファイル: second.py プロジェクト: krishnakarki195/PythonNote
#!/usr/bin/python

import sys
sys.path.insert(0, '/home/tuxfux-hlp/Desktop/batch-46/modules/extra')

import first as f


def my_add(a, b):
    ''' this function is for addition of intergers '''
    a = int(a)
    b = int(b)
    return a + b


# Main
if __name__ == '__main__':
    print "addition of two numbers is {} ".format(my_add(10, 20))
    print "addition of two strings is {}".format(f.my_add('today', ' rocks'))
コード例 #5
0
#!/usr/bin/python
import sys
sys.path.insert(
    0,
    '/home/tcloudost/Documents/git_repositories/python-batches/batch-56/modules/extra'
)

import first as f


def my_add(a, b):
    '''
		this program is for addition of integers.
	'''
    a = int(a)
    b = int(b)
    return a + b


# Main
if __name__ == '__main__':
    print "addition of two numbers is {}".format(my_add(2, 3))
    print "addition of two strings is {}".format(f.my_add("pine", "apple"))