Author Topic: Python - Adding two numbers or strings  (Read 2179 times)

kathir

  • Administrator
  • Sr. Member
  • *****
  • Posts: 283
Python - Adding two numbers or strings
« on: December 06, 2011, 04:19:04 pm »
Adding two numbers or string is python is very easy and straight forward.

Code: (Python)
#Python Source File

#mycode.py

def add(a,b)
     return a+b

#end of program


Here is how you import and execute the code

>>>import mycode
>>>mycode.add(100,200)
300

>>>mycode.add("Software & ", "Finance")
Software & Finance

>>> quit()

« Last Edit: December 06, 2011, 05:02:44 pm by kathir »

 


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1